From f97ed2b7684c05ed91f5be25ba9d9ac91834b5b7 Mon Sep 17 00:00:00 2001 From: santhosh ratala Date: Wed, 10 Jan 2024 14:58:50 +0800 Subject: [PATCH 1/2] Add deployment_circuit_breaker & health_check_grace_period vars to ECS Service module --- README.md | 88 +--------------------------- examples/ec2/README.MD | 4 +- examples/fargate/README.MD | 2 +- main.tf | 4 +- modules/autoscaling-group/README.md | 63 -------------------- modules/autoscaling-policy/README.md | 74 +---------------------- modules/cluster/README.md | 70 +--------------------- modules/iam/README.md | 54 +---------------- modules/service-discovery/README.md | 50 +--------------- modules/service/README.md | 72 +---------------------- modules/service/main.tf | 11 ++++ modules/service/variables.tf | 12 ++++ 12 files changed, 37 insertions(+), 467 deletions(-) diff --git a/README.md b/README.md index 377c747..dcc0a31 100644 --- a/README.md +++ b/README.md @@ -24,92 +24,6 @@ No resources. ## Inputs -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [asg\_create](#input\_asg\_create) | Specify whether to create ASG resource | `bool` | `false` | no | -| [asg\_desired\_capacity](#input\_asg\_desired\_capacity) | The number of Amazon EC2 instances that should be running in the autoscaling group | `number` | `null` | no | -| [asg\_ebs\_optimized](#input\_asg\_ebs\_optimized) | If true, the launched EC2 instance will be EBS-optimized | `bool` | `true` | no | -| [asg\_enable\_monitoring](#input\_asg\_enable\_monitoring) | Enables/disables detailed monitoring | `bool` | `true` | no | -| [asg\_enabled\_metrics](#input\_asg\_enabled\_metrics) | A list of metrics to collect. The allowed values are `GroupDesiredCapacity`, `GroupInServiceCapacity`, `GroupPendingCapacity`, `GroupMinSize`, `GroupMaxSize`, `GroupInServiceInstances`, `GroupPendingInstances`, `GroupStandbyInstances`, `GroupStandbyCapacity`, `GroupTerminatingCapacity`, `GroupTerminatingInstances`, `GroupTotalCapacity`, `GroupTotalInstances` | `list(string)` |
[
"GroupDesiredCapacity",
"GroupInServiceCapacity",
"GroupPendingCapacity",
"GroupMinSize",
"GroupMaxSize",
"GroupInServiceInstances",
"GroupPendingInstances",
"GroupStandbyInstances",
"GroupStandbyCapacity",
"GroupTerminatingCapacity",
"GroupTerminatingInstances",
"GroupTotalCapacity",
"GroupTotalInstances"
]
| no | -| [asg\_health\_check\_type](#input\_asg\_health\_check\_type) | `EC2` or `ELB`. Controls how health checking is done | `string` | `"ELB"` | no | -| [asg\_iam\_instance\_profile\_arn](#input\_asg\_iam\_instance\_profile\_arn) | The IAM Instance Profile ARN to launch the instance with | `string` | `null` | no | -| [asg\_ignore\_desired\_capacity\_changes](#input\_asg\_ignore\_desired\_capacity\_changes) | Determines whether the `desired_capacity` value is ignored after initial apply. See README note for more details | `bool` | `true` | no | -| [asg\_image\_id](#input\_asg\_image\_id) | The AMI from which to launch the instance | `string` | `""` | no | -| [asg\_instance\_market\_options](#input\_asg\_instance\_market\_options) | The market (purchasing) option for the instance | `any` | `null` | no | -| [asg\_instance\_name](#input\_asg\_instance\_name) | Name that is propogated to launched EC2 instances via a tag - if not provided, defaults to `var.name` | `string` | `""` | no | -| [asg\_instance\_type](#input\_asg\_instance\_type) | The type of the instance to launch | `string` | `"t2.micro"` | no | -| [asg\_launch\_template\_description](#input\_asg\_launch\_template\_description) | Description of the launch template | `string` | `null` | no | -| [asg\_max\_size](#input\_asg\_max\_size) | The maximum size of the autoscaling group | `number` | `null` | no | -| [asg\_min\_size](#input\_asg\_min\_size) | The minimum size of the autoscaling group | `number` | `null` | no | -| [asg\_name](#input\_asg\_name) | Name of ASG resource | `string` | `""` | no | -| [asg\_network\_interface\_security\_groups](#input\_asg\_network\_interface\_security\_groups) | A list of security group IDs to associate | `list(string)` | `null` | no | -| [asg\_placement](#input\_asg\_placement) | The placement of the instance | `map(string)` | `null` | no | -| [asg\_protect\_from\_scale\_in](#input\_asg\_protect\_from\_scale\_in) | Allows setting instance protection. The autoscaling group will not select instances with this setting for termination during scale in events. | `bool` | `false` | no | -| [asg\_subnets](#input\_asg\_subnets) | A list of subnet IDs to launch resources in. Subnets automatically determine which availability zones the group will reside. Conflicts with `availability_zones` | `list(string)` | `null` | no | -| [asg\_user\_data\_base64](#input\_asg\_user\_data\_base64) | The Base64-encoded user data to provide when launching the instance | `string` | `null` | no | -| [asg\_volume\_size](#input\_asg\_volume\_size) | Specify the volume size for the root ebs | `string` | `30` | no | -| [asg\_wait\_for\_capacity\_timeout](#input\_asg\_wait\_for\_capacity\_timeout) | A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. (See also Waiting for Capacity below.) Setting this to '0' causes Terraform to skip all Capacity Waiting behavior. | `string` | `null` | no | -| [assign\_public\_ip](#input\_assign\_public\_ip) | Enable a public IP address for the container | `bool` | `false` | no | -| [create\_launch\_template](#input\_create\_launch\_template) | Create a launch template | `bool` | `true` | no | -| [enable\_execute\_command](#input\_enable\_execute\_command) | Specifies whether to enable Amazon ECS Exec for the tasks within the service | `bool` | `false` | no | -| [launch\_type](#input\_launch\_type) | The launch type on which to run your task.(EC2\|FARGATE) | `string` | `"EC2"` | no | -| [link\_ecs\_to\_asg\_capacity\_provider](#input\_link\_ecs\_to\_asg\_capacity\_provider) | Specify whether to link ECS to autoscaling group capacity provider | `bool` | `false` | no | -| [name](#input\_name) | Name of the product/project/application | `string` | `""` | no | -| [platform\_version](#input\_platform\_version) | Platform version (applicable for FARGATE launch type) | `string` | `"LATEST"` | no | -| [service\_deployment\_maximum\_percent](#input\_service\_deployment\_maximum\_percent) | Upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment. Not valid when using the DAEMON scheduling strategy. | `number` | `200` | no | -| [service\_deployment\_minimum\_healthy\_percent](#input\_service\_deployment\_minimum\_healthy\_percent) | Lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment. | `number` | `100` | no | -| [service\_map](#input\_service\_map) | A map of services to deploy | `map(any)` | `{}` | no | -| [service\_max\_capacity](#input\_service\_max\_capacity) | Maximum capacity of ECS autoscaling target, cannot be less than min\_capacity | `number` | `4` | no | -| [service\_min\_capacity](#input\_service\_min\_capacity) | Minimum capacity of ECS autoscaling target, cannot be more than max\_capacity | `number` | `1` | no | -| [service\_scale\_in\_cooldown](#input\_service\_scale\_in\_cooldown) | Time between scale in action | `number` | `300` | no | -| [service\_scale\_out\_cooldown](#input\_service\_scale\_out\_cooldown) | Time between scale out action | `number` | `300` | no | -| [service\_security\_groups](#input\_service\_security\_groups) | Security group IDs to attach to your ECS Service | `list(string)` | `[]` | no | -| [service\_subnets](#input\_service\_subnets) | Private subnets for ECS | `list(string)` | `[]` | no | -| [service\_target\_cpu\_value](#input\_service\_target\_cpu\_value) | Autoscale when CPU Usage value over the specified value. Must be specified if `enable_cpu_based_autoscaling` is `true`. | `number` | `70` | no | -| [service\_task\_execution\_role\_arn](#input\_service\_task\_execution\_role\_arn) | Default IAM role for ECS execution | `string` | `""` | no | -| [service\_task\_role\_arn](#input\_service\_task\_role\_arn) | Default IAM role for ECS task | `string` | `""` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| [aws\_ecs\_task\_definition](#output\_aws\_ecs\_task\_definition) | ARN of the ECS service | -| [ecs\_cloudwatch\_log\_group\_arn](#output\_ecs\_cloudwatch\_log\_group\_arn) | The cloudwatch log group to be used by the cluster | -| [ecs\_cloudwatch\_log\_group\_name](#output\_ecs\_cloudwatch\_log\_group\_name) | The cloudwatch log group to be used by the cluster | -| [ecs\_cluster\_arn](#output\_ecs\_cluster\_arn) | ARN of the ECS Cluster | -| [ecs\_cluster\_id](#output\_ecs\_cluster\_id) | ID of the ECS Cluster | -| [ecs\_cluster\_kms\_arn](#output\_ecs\_cluster\_kms\_arn) | The AWS Key Management Service key ID to encrypt the data between the local client and the container | -| [ecs\_cluster\_name](#output\_ecs\_cluster\_name) | The name of the ECS cluster | -| [ecs\_service\_arn](#output\_ecs\_service\_arn) | ARN of the ECS service | -| [ecs\_service\_name](#output\_ecs\_service\_name) | The name of the ECS service | - - - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | - -## Providers - -No providers. - -## Modules - -| Name | Source | Version | -|------|--------|---------| -| [autoscaling\_group](#module\_autoscaling\_group) | ./modules/autoscaling-group | n/a | -| [cluster](#module\_cluster) | ./modules/cluster | n/a | -| [service](#module\_service) | ./modules/service | n/a | -| [service\_cpu\_autoscaling\_policy](#module\_service\_cpu\_autoscaling\_policy) | ./modules/autoscaling-policy | n/a | - -## Resources - -No resources. - -## Inputs - | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [asg\_create](#input\_asg\_create) | Specify whether to create ASG resource | `bool` | `false` | no | @@ -169,4 +83,4 @@ No resources. | [ecs\_cluster\_name](#output\_ecs\_cluster\_name) | The name of the ECS cluster | | [ecs\_service\_arn](#output\_ecs\_service\_arn) | ARN of the ECS service | | [ecs\_service\_name](#output\_ecs\_service\_name) | The name of the ECS service | - + diff --git a/examples/ec2/README.MD b/examples/ec2/README.MD index 3a1eadd..e1c7e4d 100644 --- a/examples/ec2/README.MD +++ b/examples/ec2/README.MD @@ -11,8 +11,8 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.36.1 | -| [local](#provider\_local) | 2.2.3 | +| [aws](#provider\_aws) | 4.67.0 | +| [local](#provider\_local) | 2.4.1 | ## Modules diff --git a/examples/fargate/README.MD b/examples/fargate/README.MD index ede8112..d193194 100644 --- a/examples/fargate/README.MD +++ b/examples/fargate/README.MD @@ -10,7 +10,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.45.0 | +| [aws](#provider\_aws) | 4.67.0 | ## Modules diff --git a/main.tf b/main.tf index 550515d..a990c91 100644 --- a/main.tf +++ b/main.tf @@ -60,8 +60,10 @@ module "service" { deployment_maximum_percent = lookup(each.value, "deployment_maximum_percent", var.service_deployment_maximum_percent) deployment_minimum_healthy_percent = lookup(each.value, "deployment_minimum_healthy_percent", var.service_deployment_minimum_healthy_percent) + deployment_circuit_breaker = lookup(each.value, "deployment_circuit_breaker", {}) - ecs_load_balancers = lookup(each.value, "ecs_load_balancers", []) + ecs_load_balancers = lookup(each.value, "ecs_load_balancers", []) + health_check_grace_period_seconds = lookup(each.value, "health_check_grace_period_seconds", null) docker_volumes = try(each.value.docker_volumes, []) efs_volumes = try(each.value.efs_volumes, []) diff --git a/modules/autoscaling-group/README.md b/modules/autoscaling-group/README.md index 9773e2b..4b1f892 100644 --- a/modules/autoscaling-group/README.md +++ b/modules/autoscaling-group/README.md @@ -60,66 +60,3 @@ No resources. | [autoscaling\_group\_id](#output\_autoscaling\_group\_id) | The autoscaling group id | | [autoscaling\_group\_name](#output\_autoscaling\_group\_name) | The autoscaling group name | - - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | - -## Providers - -No providers. - -## Modules - -| Name | Source | Version | -|------|--------|---------| -| [asg](#module\_asg) | terraform-aws-modules/autoscaling/aws | ~> 5.1 | - -## Resources - -No resources. - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [create](#input\_create) | Specify whether to create ASG resource | `bool` | `false` | no | -| [create\_launch\_template](#input\_create\_launch\_template) | Create a launch template or not | `bool` | `true` | no | -| [desired\_capacity](#input\_desired\_capacity) | The number of Amazon EC2 instances that should be running in the autoscaling group | `number` | `null` | no | -| [ebs\_optimized](#input\_ebs\_optimized) | If true, the launched EC2 instance will be EBS-optimized | `bool` | `true` | no | -| [enable\_monitoring](#input\_enable\_monitoring) | Enables/disables detailed monitoring | `bool` | `true` | no | -| [enabled\_metrics](#input\_enabled\_metrics) | A list of metrics to collect. The allowed values are `GroupDesiredCapacity`, `GroupInServiceCapacity`, `GroupPendingCapacity`, `GroupMinSize`, `GroupMaxSize`, `GroupInServiceInstances`, `GroupPendingInstances`, `GroupStandbyInstances`, `GroupStandbyCapacity`, `GroupTerminatingCapacity`, `GroupTerminatingInstances`, `GroupTotalCapacity`, `GroupTotalInstances` | `list(string)` |
[
"GroupDesiredCapacity",
"GroupInServiceCapacity",
"GroupPendingCapacity",
"GroupMinSize",
"GroupMaxSize",
"GroupInServiceInstances",
"GroupPendingInstances",
"GroupStandbyInstances",
"GroupStandbyCapacity",
"GroupTerminatingCapacity",
"GroupTerminatingInstances",
"GroupTotalCapacity",
"GroupTotalInstances"
]
| no | -| [health\_check\_type](#input\_health\_check\_type) | `EC2` or `ELB`. Controls how health checking is done | `string` | `"ELB"` | no | -| [iam\_instance\_profile\_arn](#input\_iam\_instance\_profile\_arn) | The IAM Instance Profile ARN to launch the instance with | `string` | `null` | no | -| [ignore\_desired\_capacity\_changes](#input\_ignore\_desired\_capacity\_changes) | Determines whether the `desired_capacity` value is ignored after initial apply. See README note for more details | `bool` | `true` | no | -| [image\_id](#input\_image\_id) | The AMI from which to launch the instance | `string` | `""` | no | -| [instance\_market\_options](#input\_instance\_market\_options) | The market (purchasing) option for the instance | `any` | `null` | no | -| [instance\_name](#input\_instance\_name) | Name that is propogated to launched EC2 instances via a tag - if not provided, defaults to `var.name` | `string` | `""` | no | -| [instance\_type](#input\_instance\_type) | The type of the instance to launch | `string` | `null` | no | -| [launch\_template](#input\_launch\_template) | Name of an existing launch template to be used (created outside of this module) | `string` | `null` | no | -| [launch\_template\_description](#input\_launch\_template\_description) | Description of the launch template | `string` | `null` | no | -| [launch\_type](#input\_launch\_type) | Launch type | `string` | `"EC2"` | no | -| [max\_size](#input\_max\_size) | The maximum size of the autoscaling group | `number` | `null` | no | -| [metadata\_options](#input\_metadata\_options) | Customize the metadata options (IMDS) for the instance |
object({
http_endpoint = string
http_tokens = string
http_put_response_hop_limit = number
instance_metadata_tags = string
})
|
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "required",
"instance_metadata_tags": "disabled"
}
| no | -| [min\_size](#input\_min\_size) | The minimum size of the autoscaling group | `number` | `null` | no | -| [name](#input\_name) | Name of the product/project/application | `string` | `""` | no | -| [network\_interface\_security\_groups](#input\_network\_interface\_security\_groups) | A list of security group IDs to associate | `list(string)` | `null` | no | -| [placement](#input\_placement) | The placement of the instance | `map(string)` | `null` | no | -| [protect\_from\_scale\_in](#input\_protect\_from\_scale\_in) | Allows setting instance protection. The autoscaling group will not select instances with this setting for termination during scale in events. | `bool` | `false` | no | -| [subnets](#input\_subnets) | A list of subnet IDs to launch resources in. Subnets automatically determine which availability zones the group will reside. Conflicts with `availability_zones` | `list(string)` | `null` | no | -| [tags](#input\_tags) | A map of tags to assign to resources | `map(string)` | `{}` | no | -| [user\_data\_base64](#input\_user\_data\_base64) | The Base64-encoded user data to provide when launching the instance | `string` | `null` | no | -| [volume\_size](#input\_volume\_size) | Specify the volume size for the root ebs | `string` | n/a | yes | -| [wait\_for\_capacity\_timeout](#input\_wait\_for\_capacity\_timeout) | A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. (See also Waiting for Capacity below.) Setting this to '0' causes Terraform to skip all Capacity Waiting behavior. | `string` | `null` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| [autoscaling\_group\_arn](#output\_autoscaling\_group\_arn) | The ARN for this AutoScaling Group | -| [autoscaling\_group\_id](#output\_autoscaling\_group\_id) | The autoscaling group id | -| [autoscaling\_group\_name](#output\_autoscaling\_group\_name) | The autoscaling group name | - diff --git a/modules/autoscaling-policy/README.md b/modules/autoscaling-policy/README.md index aa3fe10..2d2eb9d 100644 --- a/modules/autoscaling-policy/README.md +++ b/modules/autoscaling-policy/README.md @@ -10,7 +10,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.36.1 | +| [aws](#provider\_aws) | 5.31.0 | ## Modules @@ -69,75 +69,3 @@ No modules. | [memory\_policy\_name](#output\_memory\_policy\_name) | Name of the autoscaling policy generated | | [memory\_policy\_type](#output\_memory\_policy\_type) | Policy type of the autoscaling policy generated. Always TargetTrackingScaling | - - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | -| [aws](#requirement\_aws) | >= 4.0 | - -## Providers - -| Name | Version | -|------|---------| -| [aws](#provider\_aws) | >= 4.0 | - -## Modules - -No modules. - -## Resources - -| Name | Type | -|------|------| -| [aws_appautoscaling_policy.ecs_service_cpu_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appautoscaling_policy) | resource | -| [aws_appautoscaling_policy.ecs_service_memory_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appautoscaling_policy) | resource | -| [aws_appautoscaling_target.ecs_target](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appautoscaling_target) | resource | -| [aws_autoscaling_policy.asg_cpu_autoscaling](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_policy) | resource | -| [aws_autoscaling_policy.asg_memory_autoscaling](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_policy) | resource | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [autoscaling\_group\_name](#input\_autoscaling\_group\_name) | Autoscaling Group to apply the policy | `string` | `null` | no | -| [cpu\_statistics](#input\_cpu\_statistics) | Statistics to use: [Maximum, SampleCount, Sum, Minimum, Average]. Note that resolution used in alarm generated is 1 minute. | `string` | `"Average"` | no | -| [cpu\_threshold](#input\_cpu\_threshold) | Keep the ECS Cluster CPU Reservation around this value. Value is in percentage (0..100). Must be specified if cpu based autoscaling is enabled. | `number` | `null` | no | -| [disable\_scale\_in](#input\_disable\_scale\_in) | Disable scale-in action, defaults to false | `bool` | `false` | no | -| [ecs\_cluster\_name](#input\_ecs\_cluster\_name) | ECS Cluster name to apply on (NOT ARN) | `string` | n/a | yes | -| [ecs\_service\_name](#input\_ecs\_service\_name) | ECS Service name to apply on (NOT ARN) | `string` | n/a | yes | -| [enable\_asg\_cpu\_based\_autoscaling](#input\_enable\_asg\_cpu\_based\_autoscaling) | Enable Autoscaling based on ECS Cluster CPU Reservation | `bool` | `false` | no | -| [enable\_asg\_memory\_based\_autoscaling](#input\_enable\_asg\_memory\_based\_autoscaling) | Enable Autoscaling based on ECS Cluster Memory Reservation | `bool` | `false` | no | -| [enable\_ecs\_cpu\_based\_autoscaling](#input\_enable\_ecs\_cpu\_based\_autoscaling) | Enable Autoscaling based on ECS Service CPU Usage | `bool` | `false` | no | -| [enable\_ecs\_memory\_based\_autoscaling](#input\_enable\_ecs\_memory\_based\_autoscaling) | Enable Autoscaling based on ECS Service Memory Usage | `bool` | `false` | no | -| [max\_capacity](#input\_max\_capacity) | Maximum capacity of ECS autoscaling target, cannot be less than min\_capacity | `number` | n/a | yes | -| [memory\_statistics](#input\_memory\_statistics) | Statistics to use: [Maximum, SampleCount, Sum, Minimum, Average]. Note that resolution used in alarm generated is 1 minute. | `string` | `"Average"` | no | -| [memory\_threshold](#input\_memory\_threshold) | Keep the ECS Cluster Memory Reservation around this value. Value is in percentage (0..100). Must be specified if memory based autoscaling is enabled. | `number` | `null` | no | -| [min\_capacity](#input\_min\_capacity) | Minimum capacity of ECS autoscaling target, cannot be more than max\_capacity | `number` | n/a | yes | -| [name](#input\_name) | Name of the ECS Policy created, will appear in Auto Scaling under Service in ECS | `string` | n/a | yes | -| [scale\_in\_cooldown](#input\_scale\_in\_cooldown) | Time between scale in action | `number` | `300` | no | -| [scale\_out\_cooldown](#input\_scale\_out\_cooldown) | Time between scale out action | `number` | `300` | no | -| [target\_cpu\_value](#input\_target\_cpu\_value) | Autoscale when CPU Usage value over the specified value. Must be specified if `enable_cpu_based_autoscaling` is `true`. | `number` | `null` | no | -| [target\_memory\_value](#input\_target\_memory\_value) | Autoscale when Memory Usage value over the specified value. Must be specified if `enable_memory_based_autoscaling` is `true`. | `number` | `null` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| [cpu\_autoscaling\_arn](#output\_cpu\_autoscaling\_arn) | The ARN assigned by AWS to the scaling policy. | -| [cpu\_autoscaling\_asg\_name](#output\_cpu\_autoscaling\_asg\_name) | The scaling policy's assigned autoscaling group. | -| [cpu\_autoscaling\_name](#output\_cpu\_autoscaling\_name) | The scaling policy's name. | -| [cpu\_autoscaling\_policy\_type](#output\_cpu\_autoscaling\_policy\_type) | The scaling policy's type. | -| [cpu\_policy\_arn](#output\_cpu\_policy\_arn) | ARN of the autoscaling policy generated. | -| [cpu\_policy\_name](#output\_cpu\_policy\_name) | Name of the autoscaling policy generated | -| [cpu\_policy\_type](#output\_cpu\_policy\_type) | Policy type of the autoscaling policy generated. Always TargetTrackingScaling | -| [memory\_autoscaling\_arn](#output\_memory\_autoscaling\_arn) | The ARN assigned by AWS to the scaling policy. | -| [memory\_autoscaling\_asg\_name](#output\_memory\_autoscaling\_asg\_name) | The scaling policy's assigned autoscaling group. | -| [memory\_autoscaling\_name](#output\_memory\_autoscaling\_name) | The scaling policy's name. | -| [memory\_autoscaling\_policy\_type](#output\_memory\_autoscaling\_policy\_type) | The scaling policy's type. | -| [memory\_policy\_arn](#output\_memory\_policy\_arn) | ARN of the autoscaling policy generated. | -| [memory\_policy\_name](#output\_memory\_policy\_name) | Name of the autoscaling policy generated | -| [memory\_policy\_type](#output\_memory\_policy\_type) | Policy type of the autoscaling policy generated. Always TargetTrackingScaling | - diff --git a/modules/cluster/README.md b/modules/cluster/README.md index 7bb5690..ba3e985 100644 --- a/modules/cluster/README.md +++ b/modules/cluster/README.md @@ -10,7 +10,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.36.1 | +| [aws](#provider\_aws) | 5.31.0 | ## Modules @@ -65,71 +65,3 @@ No modules. | [ecs\_cluster\_kms\_arn](#output\_ecs\_cluster\_kms\_arn) | The AWS Key Management Service key ID to encrypt the data between the local client and the container | | [ecs\_cluster\_name](#output\_ecs\_cluster\_name) | The name of the ECS cluster | - - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | -| [aws](#requirement\_aws) | >= 4.0 | - -## Providers - -| Name | Version | -|------|---------| -| [aws](#provider\_aws) | >= 4.0 | - -## Modules - -No modules. - -## Resources - -| Name | Type | -|------|------| -| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource | -| [aws_ecs_capacity_provider.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_capacity_provider) | resource | -| [aws_ecs_cluster.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster) | resource | -| [aws_ecs_cluster_capacity_providers.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster_capacity_providers) | resource | -| [aws_kms_key.cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource | -| [aws_kms_key.cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource | -| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | -| [aws_iam_policy_document.cloudwatch_logs_allow_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | -| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [asg\_arn](#input\_asg\_arn) | Autoscaling Group ARN | `string` | `""` | no | -| [capacity\_providers](#input\_capacity\_providers) | List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE\_SPOT. | `list(string)` | `[]` | no | -| [create\_capacity\_provider](#input\_create\_capacity\_provider) | Specify whether to create autoscaling based capacity provider | `bool` | `true` | no | -| [create\_log\_group](#input\_create\_log\_group) | Whether to create log group | `bool` | `true` | no | -| [default\_capacity\_provider\_strategy](#input\_default\_capacity\_provider\_strategy) | The capacity provider strategy to use by default for the cluster. Can be one or more. | `list(map(any))` | `[]` | no | -| [ecs\_cluster\_name](#input\_ecs\_cluster\_name) | Name of the ecs cluster | `string` | `null` | no | -| [ecs\_container\_insights](#input\_ecs\_container\_insights) | Whether to enable container insights for ECS cluster | `bool` | `true` | no | -| [ecs\_encrypt\_logs](#input\_ecs\_encrypt\_logs) | Enable encryption for cloudwatch logs | `bool` | `true` | no | -| [key\_admin\_arn](#input\_key\_admin\_arn) | Key administrator principal for the KMS key | `string` | `""` | no | -| [link\_ecs\_to\_asg\_capacity\_provider](#input\_link\_ecs\_to\_asg\_capacity\_provider) | Specify whether link ECS to autoscaling group capacity provider | `bool` | `false` | no | -| [log\_group\_name](#input\_log\_group\_name) | Provide name for log group | `string` | `""` | no | -| [log\_retention](#input\_log\_retention) | Specify log retention in days | `number` | `30` | no | -| [managed\_scaling](#input\_managed\_scaling) | Specifies whether to enable managed scaling | `bool` | `true` | no | -| [name](#input\_name) | Name of the product/project/application | `string` | `""` | no | -| [scaling\_max\_step\_size](#input\_scaling\_max\_step\_size) | Sets managed scaling max step size | `number` | `10` | no | -| [scaling\_min\_step\_size](#input\_scaling\_min\_step\_size) | Sets managed scaling min step size | `number` | `1` | no | -| [scaling\_target\_capacity](#input\_scaling\_target\_capacity) | Sets managed scaling target capacity | `number` | `80` | no | -| [tags](#input\_tags) | AWS tags to be applied to resources | `map(string)` | `{}` | no | -| [termination\_protection](#input\_termination\_protection) | Enables or disables container-aware termination of instances in the auto scaling group when scale-in happens. | `bool` | `true` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| [ecs\_cloudwatch\_log\_group\_arn](#output\_ecs\_cloudwatch\_log\_group\_arn) | The cloudwatch log group to be used by the cluster | -| [ecs\_cloudwatch\_log\_group\_name](#output\_ecs\_cloudwatch\_log\_group\_name) | The cloudwatch log group to be used by the cluster | -| [ecs\_cluster\_arn](#output\_ecs\_cluster\_arn) | ARN of the ECS Cluster | -| [ecs\_cluster\_id](#output\_ecs\_cluster\_id) | ID of the ECS Cluster | -| [ecs\_cluster\_kms\_arn](#output\_ecs\_cluster\_kms\_arn) | The AWS Key Management Service key ID to encrypt the data between the local client and the container | -| [ecs\_cluster\_name](#output\_ecs\_cluster\_name) | The name of the ECS cluster | - diff --git a/modules/iam/README.md b/modules/iam/README.md index 7a23d87..11cf16b 100644 --- a/modules/iam/README.md +++ b/modules/iam/README.md @@ -9,7 +9,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.36.1 | +| [aws](#provider\_aws) | 5.31.0 | ## Modules @@ -49,55 +49,3 @@ | [iam\_role\_arn](#output\_iam\_role\_arn) | ARN of IAM role | | [iam\_role\_name](#output\_iam\_role\_name) | Name of IAM role | - - -## Requirements - -| Name | Version | -|------|---------| -| [aws](#requirement\_aws) | >= 4.0 | - -## Providers - -| Name | Version | -|------|---------| -| [aws](#provider\_aws) | >= 4.0 | - -## Modules - -| Name | Source | Version | -|------|--------|---------| -| [iam\_assumable\_role](#module\_iam\_assumable\_role) | terraform-aws-modules/iam/aws//modules/iam-assumable-role | ~> 4.13.0 | -| [iam\_policy](#module\_iam\_policy) | terraform-aws-modules/iam/aws//modules/iam-policy | ~> 4.13.0 | - -## Resources - -| Name | Type | -|------|------| -| [aws_iam_role_policy_attachment.attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [create\_instance\_profile](#input\_create\_instance\_profile) | Whether to create the instance profile | `bool` | `true` | no | -| [custom\_role\_policy\_arns](#input\_custom\_role\_policy\_arns) | List of ARNs of IAM policies to attach to IAM role | `list(string)` | `[]` | no | -| [policy](#input\_policy) | The path of the policy in IAM (tpl file) | `string` | `""` | no | -| [policy\_description](#input\_policy\_description) | The description of the policy | `string` | `"IAM Policy"` | no | -| [policy\_name](#input\_policy\_name) | The name of the policy | `string` | `""` | no | -| [role\_name](#input\_role\_name) | IAM role name | `string` | `null` | no | -| [tags](#input\_tags) | A map of tags to add to IAM role resources | `map(string)` | `{}` | no | -| [trusted\_role\_arns](#input\_trusted\_role\_arns) | ARNs of AWS entities who can assume these roles | `list(string)` | `[]` | no | -| [trusted\_role\_services](#input\_trusted\_role\_services) | AWS Services that can assume these roles | `list(string)` | `[]` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| [iam\_instance\_profile\_arn](#output\_iam\_instance\_profile\_arn) | ARN of IAM instance profile | -| [iam\_instance\_profile\_name](#output\_iam\_instance\_profile\_name) | Name of IAM instance profile | -| [iam\_policy\_arn](#output\_iam\_policy\_arn) | The ARN assigned by AWS to this policy | -| [iam\_policy\_id](#output\_iam\_policy\_id) | The policy's ID | -| [iam\_role\_arn](#output\_iam\_role\_arn) | ARN of IAM role | -| [iam\_role\_name](#output\_iam\_role\_name) | Name of IAM role | - diff --git a/modules/service-discovery/README.md b/modules/service-discovery/README.md index 0def25c..80cb604 100644 --- a/modules/service-discovery/README.md +++ b/modules/service-discovery/README.md @@ -10,7 +10,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.36.1 | +| [aws](#provider\_aws) | 5.31.0 | ## Modules @@ -45,51 +45,3 @@ No modules. | [service\_arns](#output\_service\_arns) | map of service arns | | [service\_ids](#output\_service\_ids) | map of service ids | - - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | -| [aws](#requirement\_aws) | >= 4.0 | - -## Providers - -| Name | Version | -|------|---------| -| [aws](#provider\_aws) | >= 4.0 | - -## Modules - -No modules. - -## Resources - -| Name | Type | -|------|------| -| [aws_service_discovery_private_dns_namespace.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/service_discovery_private_dns_namespace) | resource | -| [aws_service_discovery_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/service_discovery_service) | resource | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [enable\_service\_discovery](#input\_enable\_service\_discovery) | Whether to enable service discovery for tasks | `bool` | `true` | no | -| [internal\_dns\_name](#input\_internal\_dns\_name) | Internal DNS name, required when enabling service discovery | `string` | `""` | no | -| [service\_discovery\_health\_check\_failure\_threshold](#input\_service\_discovery\_health\_check\_failure\_threshold) | The health check failure threshold | `number` | `1` | no | -| [service\_discovery\_record\_ttl](#input\_service\_discovery\_record\_ttl) | The DNS record ttl used in service discovery | `number` | `10` | no | -| [service\_discovery\_record\_type](#input\_service\_discovery\_record\_type) | The DNS record type used in service discovery | `string` | `"A"` | no | -| [service\_discovery\_routing\_policy](#input\_service\_discovery\_routing\_policy) | The routing policy used in service discovery | `string` | `"MULTIVALUE"` | no | -| [service\_names](#input\_service\_names) | List of service names to create service discovery | `list(string)` | `[]` | no | -| [vpc\_id](#input\_vpc\_id) | The VPC identifier | `string` | n/a | yes | - -## Outputs - -| Name | Description | -|------|-------------| -| [namespace\_arn](#output\_namespace\_arn) | arn of the namespace | -| [namespace\_id](#output\_namespace\_id) | The ID of the namespace that you want to use to create the service. | -| [service\_arns](#output\_service\_arns) | map of service arns | -| [service\_ids](#output\_service\_ids) | map of service ids | - diff --git a/modules/service/README.md b/modules/service/README.md index 24af042..9345896 100644 --- a/modules/service/README.md +++ b/modules/service/README.md @@ -10,7 +10,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.36.1 | +| [aws](#provider\_aws) | 5.31.0 | ## Modules @@ -31,6 +31,7 @@ No modules. | [assign\_public\_ip](#input\_assign\_public\_ip) | Flag for enabling/disabling public IP for ECS Containers | `bool` | `false` | no | | [cluster\_id](#input\_cluster\_id) | Cluster ID | `string` | n/a | yes | | [container\_definitions](#input\_container\_definitions) | A list of container definitions in JSON format that describe the different containers that make up your task | `string` | n/a | yes | +| [deployment\_circuit\_breaker](#input\_deployment\_circuit\_breaker) | Configuration block for deployment circuit breaker | `any` | `{}` | no | | [deployment\_controller\_type](#input\_deployment\_controller\_type) | Type of deployment controller. Valid values are `CODE_DEPLOY` and `ECS` | `string` | `"ECS"` | no | | [deployment\_maximum\_percent](#input\_deployment\_maximum\_percent) | Upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment. Not valid when using the DAEMON scheduling strategy. | `number` | `200` | no | | [deployment\_minimum\_healthy\_percent](#input\_deployment\_minimum\_healthy\_percent) | Lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment. | `number` | `100` | no | @@ -41,6 +42,7 @@ No modules. | [enable\_ecs\_managed\_tags](#input\_enable\_ecs\_managed\_tags) | Specifies whether to enable Amazon ECS managed tags for the tasks within the service | `bool` | `true` | no | | [enable\_execute\_command](#input\_enable\_execute\_command) | Specifies whether to enable Amazon ECS Exec for the tasks within the service | `bool` | `false` | no | | [execution\_role\_arn](#input\_execution\_role\_arn) | ECS excution role arn | `string` | `""` | no | +| [health\_check\_grace\_period\_seconds](#input\_health\_check\_grace\_period\_seconds) | Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 2147483647. Only valid for services configured to use load balancers | `number` | `null` | no | | [launch\_type](#input\_launch\_type) | Launch type | `string` | `"EC2"` | no | | [name](#input\_name) | The Service name | `string` | n/a | yes | | [network\_mode](#input\_network\_mode) | Networking Mode Type | `string` | `"awsvpc"` | no | @@ -65,71 +67,3 @@ No modules. | [ecs\_service\_arn](#output\_ecs\_service\_arn) | ARN of the ECS service | | [ecs\_service\_name](#output\_ecs\_service\_name) | The name of the ECS service | - - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | -| [aws](#requirement\_aws) | >= 4.0 | - -## Providers - -| Name | Version | -|------|---------| -| [aws](#provider\_aws) | >= 4.0 | - -## Modules - -No modules. - -## Resources - -| Name | Type | -|------|------| -| [aws_ecs_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service) | resource | -| [aws_ecs_task_definition.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition) | resource | -| [aws_ecs_task_definition.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecs_task_definition) | data source | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [assign\_public\_ip](#input\_assign\_public\_ip) | Flag for enabling/disabling public IP for ECS Containers | `bool` | `false` | no | -| [cluster\_id](#input\_cluster\_id) | Cluster ID | `string` | n/a | yes | -| [container\_definitions](#input\_container\_definitions) | A list of container definitions in JSON format that describe the different containers that make up your task | `string` | n/a | yes | -| [deployment\_controller\_type](#input\_deployment\_controller\_type) | Type of deployment controller. Valid values are `CODE_DEPLOY` and `ECS` | `string` | `"ECS"` | no | -| [deployment\_maximum\_percent](#input\_deployment\_maximum\_percent) | Upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment. Not valid when using the DAEMON scheduling strategy. | `number` | `200` | no | -| [deployment\_minimum\_healthy\_percent](#input\_deployment\_minimum\_healthy\_percent) | Lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment. | `number` | `100` | no | -| [desired\_count](#input\_desired\_count) | Number of instances of the task definition to place and keep running. | `number` | `0` | no | -| [docker\_volumes](#input\_docker\_volumes) | Task docker volume definitions as list of configuration objects. You cannot define both Docker volumes and EFS volumes on the same task definition. | `list(any)` | `[]` | no | -| [ecs\_load\_balancers](#input\_ecs\_load\_balancers) | Configuration block for load balancers. | `list(any)` | `[]` | no | -| [efs\_volumes](#input\_efs\_volumes) | Task EFS volume definitions as list of configuration objects. You cannot define both Docker volumes and EFS volumes on the same task definition. | `list(any)` | `[]` | no | -| [enable\_ecs\_managed\_tags](#input\_enable\_ecs\_managed\_tags) | Specifies whether to enable Amazon ECS managed tags for the tasks within the service | `bool` | `true` | no | -| [enable\_execute\_command](#input\_enable\_execute\_command) | Specifies whether to enable Amazon ECS Exec for the tasks within the service | `bool` | `false` | no | -| [execution\_role\_arn](#input\_execution\_role\_arn) | ECS excution role arn | `string` | `""` | no | -| [launch\_type](#input\_launch\_type) | Launch type | `string` | `"EC2"` | no | -| [name](#input\_name) | The Service name | `string` | n/a | yes | -| [network\_mode](#input\_network\_mode) | Networking Mode Type | `string` | `"awsvpc"` | no | -| [ordered\_placement\_strategy](#input\_ordered\_placement\_strategy) | Service level strategy rules that are taken into consideration during task placement. |
list(object({
type = string
field = string
}))
| `[]` | no | -| [platform\_version](#input\_platform\_version) | Platform version (applicable for FARGATE launch type) | `string` | `"LATEST"` | no | -| [propagate\_tags](#input\_propagate\_tags) | Specifies whether to propagate the tags from the task definition or the service to the tasks. The valid values are SERVICE and TASK\_DEFINITION | `string` | `"TASK_DEFINITION"` | no | -| [security\_groups](#input\_security\_groups) | Security group IDs to attach to your ECS Service | `list(string)` | `null` | no | -| [service\_placement\_constraints](#input\_service\_placement\_constraints) | The rules that are taken into consideration during task placement. Maximum number of placement\_constraints is 10. |
list(object({
type = string
expression = string
}))
| `[]` | no | -| [service\_registries](#input\_service\_registries) | Service discovery registries for the service. The maximum number of service\_registries blocks is 1 | `list(any)` | `[]` | no | -| [subnets](#input\_subnets) | Private subnets for ECS | `list(string)` | `null` | no | -| [tags](#input\_tags) | Tags for ECS cluster | `map(string)` | `{}` | no | -| [task\_cpu](#input\_task\_cpu) | Number of cpu units used by the task. If the requires\_compatibilities is FARGATE this field is required. | `number` | `256` | no | -| [task\_memory](#input\_task\_memory) | Amount (in MiB) of memory used by the task. If the requires\_compatibilities is FARGATE this field is required. | `number` | `512` | no | -| [task\_placement\_constraints](#input\_task\_placement\_constraints) | The rules that are taken into consideration during task placement. Maximum number of placement\_constraints is 10 |
list(object({
type = string
expression = string
}))
| `[]` | no | -| [task\_role\_arn](#input\_task\_role\_arn) | Task role arn | `string` | `""` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| [aws\_ecs\_task\_definition](#output\_aws\_ecs\_task\_definition) | ARN of the ECS service | -| [ecs\_service\_arn](#output\_ecs\_service\_arn) | ARN of the ECS service | -| [ecs\_service\_name](#output\_ecs\_service\_name) | The name of the ECS service | - diff --git a/modules/service/main.tf b/modules/service/main.tf index 31a4c6d..e49e500 100644 --- a/modules/service/main.tf +++ b/modules/service/main.tf @@ -90,6 +90,8 @@ resource "aws_ecs_service" "this" { enable_execute_command = var.enable_execute_command propagate_tags = var.propagate_tags + health_check_grace_period_seconds = var.health_check_grace_period_seconds + deployment_maximum_percent = var.deployment_maximum_percent deployment_minimum_healthy_percent = var.deployment_minimum_healthy_percent @@ -97,6 +99,15 @@ resource "aws_ecs_service" "this" { type = var.deployment_controller_type } + dynamic "deployment_circuit_breaker" { + for_each = length(var.deployment_circuit_breaker) > 0 ? [var.deployment_circuit_breaker] : [] + + content { + enable = deployment_circuit_breaker.value.enable + rollback = deployment_circuit_breaker.value.rollback + } + } + dynamic "service_registries" { for_each = var.service_registries diff --git a/modules/service/variables.tf b/modules/service/variables.tf index ab95190..b4f05b8 100644 --- a/modules/service/variables.tf +++ b/modules/service/variables.tf @@ -101,6 +101,12 @@ variable "ecs_load_balancers" { default = [] } +variable "health_check_grace_period_seconds" { + description = "Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 2147483647. Only valid for services configured to use load balancers" + type = number + default = null +} + variable "service_registries" { description = "Service discovery registries for the service. The maximum number of service_registries blocks is 1" type = list(any) @@ -119,6 +125,12 @@ variable "deployment_minimum_healthy_percent" { default = 100 } +variable "deployment_circuit_breaker" { + description = "Configuration block for deployment circuit breaker" + type = any + default = {} +} + ################################################################################ # ECS Task Definition ################################################################################ From 4fbe6328b9364a04a3195c6b1c947925fa607d48 Mon Sep 17 00:00:00 2001 From: santhosh ratala Date: Wed, 10 Jan 2024 15:57:32 +0800 Subject: [PATCH 2/2] restructure deployment_circuit_breaker logic --- main.tf | 2 +- modules/service/main.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index a990c91..d15dfa9 100644 --- a/main.tf +++ b/main.tf @@ -60,7 +60,7 @@ module "service" { deployment_maximum_percent = lookup(each.value, "deployment_maximum_percent", var.service_deployment_maximum_percent) deployment_minimum_healthy_percent = lookup(each.value, "deployment_minimum_healthy_percent", var.service_deployment_minimum_healthy_percent) - deployment_circuit_breaker = lookup(each.value, "deployment_circuit_breaker", {}) + deployment_circuit_breaker = lookup(each.value, "deployment_circuit_breaker", { enable = false }) ecs_load_balancers = lookup(each.value, "ecs_load_balancers", []) health_check_grace_period_seconds = lookup(each.value, "health_check_grace_period_seconds", null) diff --git a/modules/service/main.tf b/modules/service/main.tf index e49e500..4a2bb60 100644 --- a/modules/service/main.tf +++ b/modules/service/main.tf @@ -100,7 +100,7 @@ resource "aws_ecs_service" "this" { } dynamic "deployment_circuit_breaker" { - for_each = length(var.deployment_circuit_breaker) > 0 ? [var.deployment_circuit_breaker] : [] + for_each = var.deployment_circuit_breaker.enable ? [var.deployment_circuit_breaker] : [] content { enable = deployment_circuit_breaker.value.enable