Skip to content

Commit 430b1bf

Browse files
jasonwalshjasonwalsh
authored andcommitted
feat: Add register_task_definition input
Provides a flag for specifying whether to create the ECS Task Definition or not.
1 parent 7b7575e commit 430b1bf

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,6 @@ resource "aws_ecs_task_definition" "ecs_task_definition" {
142142
requires_compatibilities = "${var.requires_compatibilities}"
143143
task_role_arn = "${var.task_role_arn}"
144144
volume = "${var.volumes}"
145+
146+
count = "${var.register_task_definition ? 1 : 0}"
145147
}

outputs.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
output "arn" {
22
description = "The full Amazon Resource Name (ARN) of the task definition"
3-
value = "${aws_ecs_task_definition.ecs_task_definition.arn}"
3+
value = "${join("", aws_ecs_task_definition.ecs_task_definition.*.arn)}"
44
}
55

66
output "container_definitions" {
@@ -10,10 +10,10 @@ output "container_definitions" {
1010

1111
output "family" {
1212
description = "The family of your task definition, used as the definition name"
13-
value = "${aws_ecs_task_definition.ecs_task_definition.family}"
13+
value = "${join("", aws_ecs_task_definition.ecs_task_definition.*.family)}"
1414
}
1515

1616
output "revision" {
1717
description = "The revision of the task in a particular family"
18-
value = "${aws_ecs_task_definition.ecs_task_definition.revision}"
18+
value = "${join("", aws_ecs_task_definition.ecs_task_definition.*.revision)}"
1919
}

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ variable "readonlyRootFilesystem" {
175175
description = "When this parameter is true, the container is given read-only access to its root file system"
176176
}
177177

178+
variable "register_task_definition" {
179+
default = true
180+
description = "Registers a new task definition from the supplied family and containerDefinitions"
181+
}
182+
178183
variable "repositoryCredentials" {
179184
default = {}
180185
description = "The private repository authentication credentials to use"

0 commit comments

Comments
 (0)