diff --git a/README.md b/README.md index 24ca8fd..129eb53 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ module "ecs_apps" { | certificate\_arn | n/a | `any` | n/a | yes | | certificate\_internal\_arn | certificate arn for internal ALB. | `string` | `""` | no | | code\_deploy | Enables CodeDeploy role to be used for deployment | `bool` | `true` | no | -| container\_insights | Enables CloudWatch Container Insights for a cluster. | `bool` | `false` | no | +| container\_insights | Enables CloudWatch Container Insights for a cluster. | `string` | `"disabled"` | no | | create\_efs | Enables creation of EFS volume for cluster | `bool` | `true` | no | | create\_iam\_service\_linked\_role | Create iam\_service\_linked\_role for ECS or not. | `bool` | `false` | no | | ebs\_key\_arn | ARN of a KMS Key to use on EBS volumes | `string` | `""` | no | diff --git a/_variables.tf b/_variables.tf index 2d19670..966533f 100644 --- a/_variables.tf +++ b/_variables.tf @@ -368,9 +368,13 @@ variable "extra_task_policies_arn" { } variable "container_insights" { - type = bool - default = false + type = string + default = "disabled" description = "Enables CloudWatch Container Insights for a cluster." + validation { + condition = contains(["enhanced", "enabled", "disabled"], var.container_insights) + error_message = "Container Insights must be one of: enhanced, enabled, disabled." + } } variable "alb_test_listener" { diff --git a/ecs.tf b/ecs.tf index b0efef3..0e9b18c 100644 --- a/ecs.tf +++ b/ecs.tf @@ -3,7 +3,7 @@ resource "aws_ecs_cluster" "ecs" { setting { name = "containerInsights" - value = var.container_insights ? "enabled" : "disabled" + value = var.container_insights } tags = merge( @@ -13,7 +13,7 @@ resource "aws_ecs_cluster" "ecs" { }, ) lifecycle { - ignore_changes = [] + ignore_changes = [service_connect_defaults] } }