Skip to content

Commit 09bdc54

Browse files
authored
Merge pull request #69 from DNXLabs/bugfix/ecs-setting-container-insights-value
fix: define container_insights as an enum
2 parents 0a6aba0 + 664f216 commit 09bdc54

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module "ecs_apps" {
9393
| certificate\_arn | n/a | `any` | n/a | yes |
9494
| certificate\_internal\_arn | certificate arn for internal ALB. | `string` | `""` | no |
9595
| code\_deploy | Enables CodeDeploy role to be used for deployment | `bool` | `true` | no |
96-
| container\_insights | Enables CloudWatch Container Insights for a cluster. | `bool` | `false` | no |
96+
| container\_insights | Enables CloudWatch Container Insights for a cluster. | `string` | `"disabled"` | no |
9797
| create\_efs | Enables creation of EFS volume for cluster | `bool` | `true` | no |
9898
| create\_iam\_service\_linked\_role | Create iam\_service\_linked\_role for ECS or not. | `bool` | `false` | no |
9999
| ebs\_key\_arn | ARN of a KMS Key to use on EBS volumes | `string` | `""` | no |

_variables.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,13 @@ variable "extra_task_policies_arn" {
368368
}
369369

370370
variable "container_insights" {
371-
type = bool
372-
default = false
371+
type = string
372+
default = "disabled"
373373
description = "Enables CloudWatch Container Insights for a cluster."
374+
validation {
375+
condition = contains(["enhanced", "enabled", "disabled"], var.container_insights)
376+
error_message = "Container Insights must be one of: enhanced, enabled, disabled."
377+
}
374378
}
375379

376380
variable "alb_test_listener" {

ecs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ resource "aws_ecs_cluster" "ecs" {
33

44
setting {
55
name = "containerInsights"
6-
value = var.container_insights ? "enabled" : "disabled"
6+
value = var.container_insights
77
}
88

99
tags = merge(
@@ -13,7 +13,7 @@ resource "aws_ecs_cluster" "ecs" {
1313
},
1414
)
1515
lifecycle {
16-
ignore_changes = []
16+
ignore_changes = [service_connect_defaults]
1717

1818
}
1919
}

0 commit comments

Comments
 (0)