Skip to content

Commit 75a90e1

Browse files
author
diego
committed
Support for placement constraints
1 parent ae461e0 commit 75a90e1

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@ Sample to use an existing Target Group
3636
```
3737
target_group = "arn:aws:elasticloadbalancing:us-east-1:11111111:targetgroup/mycustomtg/1111111"
3838
```
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+
```

main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ resource "aws_ecs_task_definition" "this" {
1919
task_role_arn = "${aws_iam_role.this.arn}"
2020
execution_role_arn = "${var.enable_ssm ? aws_iam_role.this.arn : ""}"
2121
requires_compatibilities = ["${var.compatibilities}"]
22+
placement_constraints = "${var.placement_constraints}"
2223
}
2324

2425
resource "aws_ecs_task_definition" "private" {

variables.tf

+7-1
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,10 @@ variable "proto_http" {
109109
variable "target_group" {
110110
description = "Set existing Target Group for new service"
111111
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+
}

0 commit comments

Comments
 (0)