From 11ac14b6b0b437a2d31115bec669361001ac9ef1 Mon Sep 17 00:00:00 2001 From: michaelaw320 <michaelaw320@gmail.com> Date: Fri, 12 Jan 2024 11:25:00 +0900 Subject: [PATCH] Expose placement constraints on easy EC2 module --- modules/simple/ec2/README.md | 1 + modules/simple/ec2/main.tf | 2 ++ modules/simple/ec2/variables.tf | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/modules/simple/ec2/README.md b/modules/simple/ec2/README.md index 0ac20f9..3a5ce72 100644 --- a/modules/simple/ec2/README.md +++ b/modules/simple/ec2/README.md @@ -63,6 +63,7 @@ No resources. | <a name="input_memory"></a> [memory](#input\_memory) | Memory for this task | `number` | `null` | no | | <a name="input_name"></a> [name](#input\_name) | The service name. | `string` | n/a | yes | | <a name="input_network_mode"></a> [network\_mode](#input\_network\_mode) | Network mode of the container, valid options are none, bridge, awsvpc, and host | `string` | `"bridge"` | no | +| <a name="input_placement_constraints"></a> [placement\_constraints](#input\_placement\_constraints) | Placement constraints for Task Definition. List of map. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#placement_constraints) | `list(any)` | `[]` | no | | <a name="input_propagate_tags"></a> [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` | `null` | no | | <a name="input_proxy_configuration"></a> [proxy\_configuration](#input\_proxy\_configuration) | The proxy configuration details for the App Mesh proxy. Defined as map argument. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#proxy_configuration) | `any` | `null` | no | | <a name="input_runtime_platform"></a> [runtime\_platform](#input\_runtime\_platform) | Runtime platform (operating system and CPU architecture) that containers may use. Defined as map argument. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#runtime_platform) | `any` | `null` | no | diff --git a/modules/simple/ec2/main.tf b/modules/simple/ec2/main.tf index dc13d6b..6ec5413 100644 --- a/modules/simple/ec2/main.tf +++ b/modules/simple/ec2/main.tf @@ -45,6 +45,8 @@ module "ec2" { } ] + placement_constraints = var.placement_constraints + wait_for_steady_state = var.wait_for_steady_state enable_ecs_managed_tags = var.enable_ecs_managed_tags diff --git a/modules/simple/ec2/variables.tf b/modules/simple/ec2/variables.tf index 7e88bdf..a4278c1 100644 --- a/modules/simple/ec2/variables.tf +++ b/modules/simple/ec2/variables.tf @@ -149,6 +149,12 @@ variable "capacity_provider_arn" { type = string } +variable "placement_constraints" { + description = "Placement constraints for Task Definition. List of map. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#placement_constraints)" + default = [] + type = list(any) +} + variable "enable_deployment_circuit_breaker_without_rollback" { description = "Enable Deployment Circuit Breaker without Rollback." default = false