Skip to content

Commit

Permalink
Adding the task placement constraint in the main.tf for ecs service c…
Browse files Browse the repository at this point in the history
…reation (#21)
  • Loading branch information
balajimoses authored Jan 3, 2024
1 parent 50b9d5d commit f13c556
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ No resources.
| <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 |
| <a name="input_service_subnets"></a> [service\_subnets](#input\_service\_subnets) | Private subnets for ECS | `list(string)` | `[]` | no |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |

## Outputs

Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ module "service" {

assign_public_ip = var.assign_public_ip

enable_execute_command = var.enable_execute_command
enable_execute_command = var.enable_execute_command
task_placement_constraints = var.task_placement_constraints
}

module "service_cpu_autoscaling_policy" {
Expand Down
9 changes: 9 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,12 @@ variable "service_scale_out_cooldown" {
type = number
default = 300
}

variable "task_placement_constraints" {
description = "The rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10"
type = list(object({
type = string
expression = string
}))
default = []
}

0 comments on commit f13c556

Please sign in to comment.