File tree 3 files changed +17
-1
lines changed
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -36,3 +36,12 @@ Sample to use an existing Target Group
36
36
```
37
37
target_group = "arn:aws:elasticloadbalancing:us-east-1:11111111:targetgroup/mycustomtg/1111111"
38
38
```
39
+
40
+ Sample to use Placement Constraints
41
+ --------------------------------------
42
+ ```
43
+ placement_constraints {
44
+ type = "memberOf"
45
+ expression = "attribute:ecs.availability-zone in [us-east-1a]"
46
+ }
47
+ ```
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ resource "aws_ecs_task_definition" "this" {
19
19
task_role_arn = " ${ aws_iam_role . this . arn } "
20
20
execution_role_arn = " ${ var . enable_ssm ? aws_iam_role . this . arn : " " } "
21
21
requires_compatibilities = [" ${ var . compatibilities } " ]
22
+ placement_constraints = " ${ var . placement_constraints } "
22
23
}
23
24
24
25
resource "aws_ecs_task_definition" "private" {
Original file line number Diff line number Diff line change @@ -109,4 +109,10 @@ variable "proto_http" {
109
109
variable "target_group" {
110
110
description = " Set existing Target Group for new service"
111
111
default = " "
112
- }
112
+ }
113
+
114
+ variable "placement_constraints" {
115
+ description = " (Optional) A set of rules that are taken during task placement"
116
+ type = " list"
117
+ default = []
118
+ }
You can’t perform that action at this time.
0 commit comments