Skip to content

Commit f13c556

Browse files
authored
Adding the task placement constraint in the main.tf for ecs service creation (#21)
1 parent 50b9d5d commit f13c556

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ No resources.
152152
| <a name="input_service_security_groups"></a> [service\_security\_groups](#input\_service\_security\_groups) | Security group IDs to attach to your ECS Service | `list(string)` | `[]` | no |
153153
| <a name="input_service_subnets"></a> [service\_subnets](#input\_service\_subnets) | Private subnets for ECS | `list(string)` | `[]` | no |
154154
| <a name="input_service_target_cpu_value"></a> [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 |
155-
| <a name="input_service_task_execution_role_arn"></a> [service\_task\_execution\_role\_arn](#input\_service\_task\_execution\_role\_arn) | Default IAM role for ECS execution | `string` | n/a | yes |
155+
| <a name="input_service_task_execution_role_arn"></a> [service\_task\_execution\_role\_arn](#input\_service\_task\_execution\_role\_arn) | Default IAM role for ECS execution | `string` | `""` | no |
156156
| <a name="input_service_task_role_arn"></a> [service\_task\_role\_arn](#input\_service\_task\_role\_arn) | Default IAM role for ECS task | `string` | `""` | no |
157+
| <a name="input_task_placement_constraints"></a> [task\_placement\_constraints](#input\_task\_placement\_constraints) | The rules that are taken into consideration during task placement. Maximum number of placement\_constraints is 10 | <pre>list(object({<br> type = string<br> expression = string<br> }))</pre> | `[]` | no |
157158

158159
## Outputs
159160

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ module "service" {
6868

6969
assign_public_ip = var.assign_public_ip
7070

71-
enable_execute_command = var.enable_execute_command
71+
enable_execute_command = var.enable_execute_command
72+
task_placement_constraints = var.task_placement_constraints
7273
}
7374

7475
module "service_cpu_autoscaling_policy" {

variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,12 @@ variable "service_scale_out_cooldown" {
268268
type = number
269269
default = 300
270270
}
271+
272+
variable "task_placement_constraints" {
273+
description = "The rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10"
274+
type = list(object({
275+
type = string
276+
expression = string
277+
}))
278+
default = []
279+
}

0 commit comments

Comments
 (0)