diff --git a/terraform/modules/container/README.md b/terraform/modules/container/README.md index f5ab0df..ecbca09 100644 --- a/terraform/modules/container/README.md +++ b/terraform/modules/container/README.md @@ -35,7 +35,7 @@ No modules. |------|-------------|------|---------|:--------:| | [additional\_host\_urls](#input\_additional\_host\_urls) | n/a | `list(string)` | `[]` | no | | [application\_type](#input\_application\_type) | defines what type of application is running, fullstack, client, backend, etc. will be used for cloudwatch logs | `string` | n/a | yes | -| [container\_cpu](#input\_container\_cpu) | n/a | `number` | `512` | no | +| [container\_cpu](#input\_container\_cpu) | n/a | `number` | `256` | no | | [container\_environment](#input\_container\_environment) | n/a |
list(object({
name = string
value = string
}))
| n/a | yes | | [container\_environment\_secrets](#input\_container\_environment\_secrets) | n/a |
list(object({
name = string
valueFrom = string
}))
| `[]` | no | | [container\_image](#input\_container\_image) | n/a | `string` | n/a | yes | @@ -44,6 +44,7 @@ No modules. | [environment](#input\_environment) | n/a | `string` | n/a | yes | | [health\_check\_path](#input\_health\_check\_path) | n/a | `string` | `"/"` | no | | [hostname](#input\_hostname) | n/a | `string` | n/a | yes | +| [launch\_type](#input\_launch\_type) | n/a | `string` | `"fargate"` | no | | [listener\_priority](#input\_listener\_priority) | n/a | `number` | n/a | yes | | [path](#input\_path) | n/a | `string` | `null` | no | | [project\_name](#input\_project\_name) | The overall name of the project using this infrastructure; used to group related resources by | `any` | n/a | yes | diff --git a/terraform/modules/root-dns-entry/README.md b/terraform/modules/root-dns-entry/README.md index 1a9f5e2..7aa5fa7 100644 --- a/terraform/modules/root-dns-entry/README.md +++ b/terraform/modules/root-dns-entry/README.md @@ -1,4 +1,11 @@ +# root-dns-entry + +This is used to create a root DNS entry in Route 53, for example "vrms.io" or "homeunite.us" +that have no "www" or subdomain before it. The Route 53 DNS entry points to incubator's main +ingress (cloudfront or ALB). All services that require web access (frontends or API backends) +should use this. + ## Requirements No requirements. @@ -18,18 +25,16 @@ No modules. | Name | Type | |------|------| | [aws_route53_record.www](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource | -| [aws_lb.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/lb) | data source | -| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [zone\_id](#input\_zone\_id) | n/a | `string` | n/a | yes | +| [zone\_id](#input\_zone\_id) | the Route 53 hosted zone id to create the entry | `string` | n/a | yes | ## Outputs | Name | Description | |------|-------------| -| [full\_dns\_name](#output\_full\_dns\_name) | n/a | +| [full\_dns\_name](#output\_full\_dns\_name) | full dns name, i.e. "qa.vrms.io" | \ No newline at end of file diff --git a/terraform/modules/root-dns-entry/main.tf b/terraform/modules/root-dns-entry/main.tf index 36d5f2b..2ecbd61 100644 --- a/terraform/modules/root-dns-entry/main.tf +++ b/terraform/modules/root-dns-entry/main.tf @@ -1,9 +1,20 @@ +/** + * # root-dns-entry + * + * This is used to create a root DNS entry in Route 53, for example "vrms.io" or "homeunite.us" + * that have no "www" or subdomain before it. The Route 53 DNS entry points to incubator's main + * ingress (cloudfront or ALB). All services that require web access (frontends or API backends) + * should use this. + * + */ + +#terraform-docs-ignore data "aws_route53_zone" "this" { zone_id = var.zone_id } - +#terraform-docs-ignore data "aws_lb" "this" { arn = "arn:aws:elasticloadbalancing:us-west-2:035866691871:loadbalancer/app/incubator-prod-lb/7451adf77133ef36" } diff --git a/terraform/modules/root-dns-entry/outputs.tf b/terraform/modules/root-dns-entry/outputs.tf index 30e6be7..397b478 100644 --- a/terraform/modules/root-dns-entry/outputs.tf +++ b/terraform/modules/root-dns-entry/outputs.tf @@ -1,3 +1,4 @@ output "full_dns_name" { value = data.aws_route53_zone.this.name + description = "full dns name, i.e. \"qa.vrms.io\"" } \ No newline at end of file diff --git a/terraform/modules/root-dns-entry/variables.tf b/terraform/modules/root-dns-entry/variables.tf index dbdf0fa..ec767a6 100644 --- a/terraform/modules/root-dns-entry/variables.tf +++ b/terraform/modules/root-dns-entry/variables.tf @@ -1,3 +1,4 @@ variable "zone_id" { type = string + description = "the Route 53 hosted zone id to create the entry" } diff --git a/terraform/modules/secret/README.md b/terraform/modules/secret/README.md index 0ff59d6..bff28ac 100644 --- a/terraform/modules/secret/README.md +++ b/terraform/modules/secret/README.md @@ -1,4 +1,14 @@ +# secret + +A secret is a securely-stored piece of information, +in our case a string. Things like database credentials, +oauth secrets, etc should be stored as a secret. In general, +secrets are added to running containers via environment variables. + +Instead of using AWS Secret Manager secrets, we use SSM Parameters, +as there is a cost associated with secrets. + ## Requirements No requirements. @@ -25,17 +35,17 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [application\_type](#input\_application\_type) | n/a | `string` | n/a | yes | -| [environment](#input\_environment) | n/a | `string` | `""` | no | -| [length](#input\_length) | n/a | `number` | `48` | no | -| [name](#input\_name) | n/a | `string` | n/a | yes | -| [project\_name](#input\_project\_name) | n/a | `string` | n/a | yes | -| [value](#input\_value) | n/a | `string` | `null` | no | +| [application\_type](#input\_application\_type) | frontend, backend, or fullstack | `string` | n/a | yes | +| [environment](#input\_environment) | what environment this is for - staging, production, etc | `string` | `""` | no | +| [length](#input\_length) | if letting the module set the secret value, the length of the generated random secret | `number` | `48` | no | +| [name](#input\_name) | secret name | `string` | n/a | yes | +| [project\_name](#input\_project\_name) | HfLA project name (vrms, home-unite-us, etc) | `string` | n/a | yes | +| [value](#input\_value) | when set, the secret value, otherwise generated at random | `string` | `null` | no | ## Outputs | Name | Description | |------|-------------| -| [arn](#output\_arn) | n/a | -| [value](#output\_value) | n/a | +| [arn](#output\_arn) | the ARN of the generated ssm parameter | +| [value](#output\_value) | value of autogenerated secret | \ No newline at end of file diff --git a/terraform/modules/secret/main.tf b/terraform/modules/secret/main.tf index 0ac6571..e79f4af 100644 --- a/terraform/modules/secret/main.tf +++ b/terraform/modules/secret/main.tf @@ -1,3 +1,15 @@ +/** + * # secret + * + * A secret is a securely-stored piece of information, + * in our case a string. Things like database credentials, + * oauth secrets, etc should be stored as a secret. In general, + * secrets are added to running containers via environment variables. + * + * Instead of using AWS Secret Manager secrets, we use SSM Parameters, + * as there is a cost associated with secrets. + */ + locals { secret_name = "/${var.project_name}/${var.application_type}-${var.environment != "" ? "${var.environment}-" : "" }${var.name}" } @@ -21,9 +33,11 @@ resource "aws_ssm_parameter" "this" { output "arn" { value = aws_ssm_parameter.this.arn + description = "the ARN of the generated ssm parameter" } output "value" { value = random_password.password.result sensitive = true + description = "value of autogenerated secret" } \ No newline at end of file diff --git a/terraform/modules/secret/variables.tf b/terraform/modules/secret/variables.tf index f8da27f..f315449 100644 --- a/terraform/modules/secret/variables.tf +++ b/terraform/modules/secret/variables.tf @@ -1,26 +1,32 @@ variable "project_name" { type = string + description = "HfLA project name (vrms, home-unite-us, etc)" } variable "application_type" { type = string + description = "frontend, backend, or fullstack" } variable "environment" { type = string default = "" + description = "what environment this is for - staging, production, etc" } variable "name" { type = string + description = "secret name" } variable "length" { type = number default = 48 + description = "if letting the module set the secret value, the length of the generated random secret" } variable "value" { type = string default = null + description = "when set, the secret value, otherwise generated at random" } \ No newline at end of file