diff --git a/.github/workflows/auto-context.yml b/.github/workflows/auto-context.yml index ab979e0..df1a857 100644 --- a/.github/workflows/auto-context.yml +++ b/.github/workflows/auto-context.yml @@ -27,7 +27,7 @@ jobs: make init make github/init/context.tf make readme/build - echo "::set-output name=create_pull_request::true" + echo "::set-output name=create_pull_request=true" fi else echo "This module has not yet been updated to support the context.tf pattern! Please update in order to support automatic updates." @@ -38,8 +38,6 @@ jobs: uses: cloudposse/actions/github/create-pull-request@0.22.0 with: token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} - committer: 'cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>' - author: 'cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>' commit-message: Update context.tf from origin source title: Update context.tf body: |- diff --git a/README.md b/README.md index 1ad822b..461d5dc 100644 --- a/README.md +++ b/README.md @@ -425,7 +425,7 @@ Available targets: | Name | Version | |------|---------| -| terraform | >= 0.13.0 | +| terraform | >= 0.12.26 | | aws | >= 2.0 | | random | >= 2.0 | @@ -496,7 +496,7 @@ Available targets: | codepipeline\_s3\_bucket\_force\_destroy | A boolean that indicates all objects should be deleted from the CodePipeline artifact store S3 bucket so that the bucket can be destroyed without error | `bool` | `false` | no | | container\_cpu | Atlantis CPUs per task | `number` | `256` | no | | container\_memory | Atlantis memory per task | `number` | `512` | no | -| context | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. |
object({
enabled = bool
namespace = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
label_key_case = string
label_value_case = string
})
|
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}
| no | +| context | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. |
object({
enabled = bool
namespace = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
})
|
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_order": [],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}
| no | | default\_backend\_image | ECS default (bootstrap) image | `string` | `"cloudposse/default-backend:0.1.2"` | no | | delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | | desired\_count | Atlantis desired number of tasks | `number` | `1` | no | @@ -513,7 +513,6 @@ Available targets: | ecs\_cluster\_name | Name of the ECS cluster to deploy Atlantis | `string` | n/a | yes | | enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no | | environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | -| github\_anonymous | Github Anonymous API (if `true`, token must not be set as GITHUB\_TOKEN or `github_token`) | `bool` | `false` | no | | github\_oauth\_token | GitHub OAuth token. If not provided the token is looked up from SSM | `string` | `""` | no | | github\_oauth\_token\_ssm\_name | SSM param name to lookup `github_oauth_token` if not provided | `string` | `""` | no | | github\_webhooks\_token | GitHub OAuth Token with permissions to create webhooks. If not provided the token is looked up from SSM | `string` | `""` | no | @@ -522,9 +521,7 @@ Available targets: | hostname | Atlantis URL | `string` | `""` | no | | id\_length\_limit | Limit `id` to this many characters.
Set to `0` for unlimited length.
Set to `null` for default, which is `0`.
Does not affect `id_full`. | `number` | `null` | no | | kms\_key\_id | KMS key ID used to encrypt SSM SecureString parameters | `string` | `""` | no | -| label\_key\_case | The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.
Possible values: `lower`, `title`, `upper`.
Default value: `title`. | `string` | `null` | no | | label\_order | The naming order of the id output and Name tag.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no | -| label\_value\_case | The letter case of output label values (also used in `tags` and `id`).
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Default value: `lower`. | `string` | `null` | no | | launch\_type | The ECS launch type (valid options: FARGATE or EC2) | `string` | `"FARGATE"` | no | | name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no | | namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no | diff --git a/context.tf b/context.tf index ff90b1c..f5f2797 100644 --- a/context.tf +++ b/context.tf @@ -20,7 +20,7 @@ module "this" { source = "cloudposse/label/null" - version = "0.23.0" // requires Terraform >= 0.13.0 + version = "0.22.1" // requires Terraform >= 0.12.26 enabled = var.enabled namespace = var.namespace @@ -54,8 +54,6 @@ variable "context" { regex_replace_chars = string label_order = list(string) id_length_limit = number - label_key_case = string - label_value_case = string }) default = { enabled = true @@ -70,8 +68,6 @@ variable "context" { regex_replace_chars = null label_order = [] id_length_limit = null - label_key_case = null - label_value_case = null } description = <<-EOT Single object for setting entire context at once. @@ -80,16 +76,6 @@ variable "context" { Individual variable settings (non-null) override settings in context object, except for attributes, tags, and additional_tag_map, which are merged. EOT - - validation { - condition = var.context["label_key_case"] == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"]) - error_message = "Allowed values: `lower`, `title`, `upper`." - } - - validation { - condition = var.context["label_value_case"] == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"]) - error_message = "Allowed values: `lower`, `title`, `upper`, `none`." - } } variable "enabled" { @@ -179,33 +165,4 @@ variable "id_length_limit" { EOT } -variable "label_key_case" { - type = string - default = null - description = <<-EOT - The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`. - Possible values: `lower`, `title`, `upper`. - Default value: `title`. - EOT - - validation { - condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case) - error_message = "Allowed values: `lower`, `title`, `upper`." - } -} - -variable "label_value_case" { - type = string - default = null - description = <<-EOT - The letter case of output label values (also used in `tags` and `id`). - Possible values: `lower`, `title`, `upper` and `none` (no transformation). - Default value: `lower`. - EOT - - validation { - condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case) - error_message = "Allowed values: `lower`, `title`, `upper`, `none`." - } -} #### End of copy of cloudposse/terraform-null-label/variables.tf diff --git a/docs/terraform.md b/docs/terraform.md index 4988718..c2f092b 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -3,7 +3,7 @@ | Name | Version | |------|---------| -| terraform | >= 0.13.0 | +| terraform | >= 0.12.26 | | aws | >= 2.0 | | random | >= 2.0 | @@ -74,7 +74,7 @@ | codepipeline\_s3\_bucket\_force\_destroy | A boolean that indicates all objects should be deleted from the CodePipeline artifact store S3 bucket so that the bucket can be destroyed without error | `bool` | `false` | no | | container\_cpu | Atlantis CPUs per task | `number` | `256` | no | | container\_memory | Atlantis memory per task | `number` | `512` | no | -| context | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. |
object({
enabled = bool
namespace = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
label_key_case = string
label_value_case = string
})
|
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}
| no | +| context | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. |
object({
enabled = bool
namespace = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
})
|
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_order": [],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}
| no | | default\_backend\_image | ECS default (bootstrap) image | `string` | `"cloudposse/default-backend:0.1.2"` | no | | delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | | desired\_count | Atlantis desired number of tasks | `number` | `1` | no | @@ -91,7 +91,6 @@ | ecs\_cluster\_name | Name of the ECS cluster to deploy Atlantis | `string` | n/a | yes | | enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no | | environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | -| github\_anonymous | Github Anonymous API (if `true`, token must not be set as GITHUB\_TOKEN or `github_token`) | `bool` | `false` | no | | github\_oauth\_token | GitHub OAuth token. If not provided the token is looked up from SSM | `string` | `""` | no | | github\_oauth\_token\_ssm\_name | SSM param name to lookup `github_oauth_token` if not provided | `string` | `""` | no | | github\_webhooks\_token | GitHub OAuth Token with permissions to create webhooks. If not provided the token is looked up from SSM | `string` | `""` | no | @@ -100,9 +99,7 @@ | hostname | Atlantis URL | `string` | `""` | no | | id\_length\_limit | Limit `id` to this many characters.
Set to `0` for unlimited length.
Set to `null` for default, which is `0`.
Does not affect `id_full`. | `number` | `null` | no | | kms\_key\_id | KMS key ID used to encrypt SSM SecureString parameters | `string` | `""` | no | -| label\_key\_case | The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.
Possible values: `lower`, `title`, `upper`.
Default value: `title`. | `string` | `null` | no | | label\_order | The naming order of the id output and Name tag.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no | -| label\_value\_case | The letter case of output label values (also used in `tags` and `id`).
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Default value: `lower`. | `string` | `null` | no | | launch\_type | The ECS launch type (valid options: FARGATE or EC2) | `string` | `"FARGATE"` | no | | name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no | | namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no | diff --git a/examples/complete/context.tf b/examples/complete/context.tf index ff90b1c..f5f2797 100644 --- a/examples/complete/context.tf +++ b/examples/complete/context.tf @@ -20,7 +20,7 @@ module "this" { source = "cloudposse/label/null" - version = "0.23.0" // requires Terraform >= 0.13.0 + version = "0.22.1" // requires Terraform >= 0.12.26 enabled = var.enabled namespace = var.namespace @@ -54,8 +54,6 @@ variable "context" { regex_replace_chars = string label_order = list(string) id_length_limit = number - label_key_case = string - label_value_case = string }) default = { enabled = true @@ -70,8 +68,6 @@ variable "context" { regex_replace_chars = null label_order = [] id_length_limit = null - label_key_case = null - label_value_case = null } description = <<-EOT Single object for setting entire context at once. @@ -80,16 +76,6 @@ variable "context" { Individual variable settings (non-null) override settings in context object, except for attributes, tags, and additional_tag_map, which are merged. EOT - - validation { - condition = var.context["label_key_case"] == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"]) - error_message = "Allowed values: `lower`, `title`, `upper`." - } - - validation { - condition = var.context["label_value_case"] == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"]) - error_message = "Allowed values: `lower`, `title`, `upper`, `none`." - } } variable "enabled" { @@ -179,33 +165,4 @@ variable "id_length_limit" { EOT } -variable "label_key_case" { - type = string - default = null - description = <<-EOT - The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`. - Possible values: `lower`, `title`, `upper`. - Default value: `title`. - EOT - - validation { - condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case) - error_message = "Allowed values: `lower`, `title`, `upper`." - } -} - -variable "label_value_case" { - type = string - default = null - description = <<-EOT - The letter case of output label values (also used in `tags` and `id`). - Possible values: `lower`, `title`, `upper` and `none` (no transformation). - Default value: `lower`. - EOT - - validation { - condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case) - error_message = "Allowed values: `lower`, `title`, `upper`, `none`." - } -} #### End of copy of cloudposse/terraform-null-label/variables.tf diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 031bdd2..7ac5d61 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -67,6 +67,16 @@ module "kms_key" { context = module.this.context } +module "atlantis_dns_name" { + source = "cloudposse/label/null" + version = "0.22.1" + + name = var.short_name + attributes = module.this.attributes + + # Omission of context = module.this.context is intentional +} + module "atlantis" { source = "../.." @@ -90,15 +100,15 @@ module "atlantis" { default_backend_image = var.default_backend_image healthcheck_path = var.healthcheck_path - short_name = var.short_name + short_name = module.atlantis_dns_name.id hostname = var.hostname parent_zone_id = var.parent_zone_id - # Container + // Container container_cpu = var.container_cpu container_memory = var.container_memory - # Authentication + // Authentication authentication_type = var.authentication_type alb_ingress_listener_unauthenticated_priority = var.alb_ingress_listener_unauthenticated_priority alb_ingress_listener_authenticated_priority = var.alb_ingress_listener_authenticated_priority @@ -116,7 +126,7 @@ module "atlantis" { authentication_oidc_token_endpoint = var.authentication_oidc_token_endpoint authentication_oidc_user_info_endpoint = var.authentication_oidc_user_info_endpoint - # ECS + // ECS private_subnet_ids = module.subnets.private_subnet_ids ecs_cluster_arn = aws_ecs_cluster.default.arn ecs_cluster_name = aws_ecs_cluster.default.name @@ -124,7 +134,7 @@ module "atlantis" { desired_count = var.desired_count launch_type = var.launch_type - # ALB + // ALB alb_zone_id = module.alb.alb_zone_id alb_arn_suffix = module.alb.alb_arn_suffix alb_dns_name = module.alb.alb_dns_name @@ -132,7 +142,7 @@ module "atlantis" { alb_ingress_unauthenticated_listener_arns = [module.alb.http_listener_arn] alb_ingress_unauthenticated_listener_arns_count = 1 - # CodePipeline + // CodePipeline codepipeline_enabled = var.codepipeline_enabled github_oauth_token = var.github_oauth_token github_webhooks_token = var.github_webhooks_token @@ -145,12 +155,12 @@ module "atlantis" { webhook_events = var.webhook_events codepipeline_s3_bucket_force_destroy = var.codepipeline_s3_bucket_force_destroy - # Autoscaling + // Autoscaling autoscaling_enabled = var.autoscaling_enabled autoscaling_min_capacity = var.autoscaling_min_capacity autoscaling_max_capacity = var.autoscaling_max_capacity - # Alarms + // Alarms alb_target_group_alarms_enabled = var.alb_target_group_alarms_enabled ecs_alarms_enabled = var.ecs_alarms_enabled alb_target_group_alarms_alarm_actions = [aws_sns_topic.sns_topic.arn] diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index a09279c..5947f14 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.0" + required_version = ">= 0.12.26" required_providers { aws = { diff --git a/examples/with_cognito_authentication/versions.tf b/examples/with_cognito_authentication/versions.tf index a09279c..5947f14 100644 --- a/examples/with_cognito_authentication/versions.tf +++ b/examples/with_cognito_authentication/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.0" + required_version = ">= 0.12.26" required_providers { aws = { diff --git a/examples/with_google_oidc_authentication/versions.tf b/examples/with_google_oidc_authentication/versions.tf index a09279c..5947f14 100644 --- a/examples/with_google_oidc_authentication/versions.tf +++ b/examples/with_google_oidc_authentication/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.0" + required_version = ">= 0.12.26" required_providers { aws = { diff --git a/examples/without_authentication/versions.tf b/examples/without_authentication/versions.tf index a09279c..5947f14 100644 --- a/examples/without_authentication/versions.tf +++ b/examples/without_authentication/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.0" + required_version = ">= 0.12.26" required_providers { aws = { diff --git a/main.tf b/main.tf index 4d777e3..c98aafd 100644 --- a/main.tf +++ b/main.tf @@ -51,9 +51,8 @@ module "ssh_key_pair" { module "github_webhooks" { source = "cloudposse/repository-webhooks/github" - version = "0.10.0" + version = "0.11.0" enabled = local.enabled && var.webhook_enabled ? true : false - github_anonymous = var.github_anonymous github_organization = var.repo_owner github_repositories = [var.repo_name] github_token = local.github_webhooks_token @@ -62,12 +61,12 @@ module "github_webhooks" { webhook_content_type = "json" events = var.webhook_events - # context = module.this.context + context = module.this.context } module "ecs_web_app" { source = "cloudposse/ecs-web-app/aws" - version = "0.48.2" + version = "0.52.0" region = var.region vpc_id = var.vpc_id diff --git a/test/src/examples_complete_test.go b/test/src/examples_complete_test.go index 60be42f..eb49027 100644 --- a/test/src/examples_complete_test.go +++ b/test/src/examples_complete_test.go @@ -113,19 +113,19 @@ func TestExamplesComplete(t *testing.T) { // Run `terraform output` to get the value of an output variable codebuildCacheBucketName := terraform.Output(t, terraformOptions, "codebuild_cache_bucket_name") // Verify we're getting back the outputs we expect - expectedCodebuildCacheBucketName := "eg-test-ecs-atlantis-build-" + attributes[0] + expectedCodebuildCacheBucketName := "eg-test-ecs-atlantis-" + attributes[0] + "-build" assert.Contains(t, codebuildCacheBucketName, expectedCodebuildCacheBucketName) // Run `terraform output` to get the value of an output variable codebuildProjectName := terraform.Output(t, terraformOptions, "codebuild_project_name") // Verify we're getting back the outputs we expect - expectedCodebuildProjectName := "eg-test-ecs-atlantis-build-" + attributes[0] + expectedCodebuildProjectName := "eg-test-ecs-atlantis-" + attributes[0] + "-build" assert.Equal(t, expectedCodebuildProjectName, codebuildProjectName) // Run `terraform output` to get the value of an output variable codebuildRoleId := terraform.Output(t, terraformOptions, "codebuild_role_id") // Verify we're getting back the outputs we expect - expectedCodebuildRoleId := "eg-test-ecs-atlantis-build-" + attributes[0] + expectedCodebuildRoleId := "eg-test-ecs-atlantis-" + attributes[0] + "-build" assert.Equal(t, expectedCodebuildRoleId, codebuildRoleId) // Run `terraform output` to get the value of an output variable @@ -233,10 +233,10 @@ func TestExamplesComplete(t *testing.T) { // Run `terraform output` to get the value of an output variable atlantisUrl := terraform.Output(t, terraformOptions, "atlantis_url") // Verify we're getting back the outputs we expect - assert.Equal(t, "https://ecs-atlantis-test.testing.cloudposse.co", atlantisUrl) + assert.Equal(t, "https://ecs-atlantis-test-" + attributes[0] +".testing.cloudposse.co", atlantisUrl) // Run `terraform output` to get the value of an output variable atlantisWebhookUrl := terraform.Output(t, terraformOptions, "atlantis_webhook_url") // Verify we're getting back the outputs we expect - assert.Equal(t, "https://ecs-atlantis-test.testing.cloudposse.co/events", atlantisWebhookUrl) + assert.Equal(t, "https://ecs-atlantis-test-" + attributes[0] +".testing.cloudposse.co/events", atlantisWebhookUrl) } diff --git a/variables.tf b/variables.tf index c62caf8..7344e49 100644 --- a/variables.tf +++ b/variables.tf @@ -27,12 +27,6 @@ variable "github_webhooks_token" { default = "" } -variable "github_anonymous" { - type = bool - description = "Github Anonymous API (if `true`, token must not be set as GITHUB_TOKEN or `github_token`)" - default = false -} - variable "github_oauth_token_ssm_name" { type = string description = "SSM param name to lookup `github_oauth_token` if not provided" diff --git a/versions.tf b/versions.tf index 739a73c..742577d 100644 --- a/versions.tf +++ b/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.0" + required_version = ">= 0.12.26" required_providers { aws = {