Skip to content

Commit ddc576a

Browse files
authored
Support for passing task execution role via arguments (#4)
* up-to-date * up-to-date * Support for setting task execution ARN via argument
1 parent 8a823e7 commit ddc576a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module "container_definition" {
5454
resource "aws_ecs_task_definition" "td" {
5555
family = "${var.name_preffix}-td"
5656
container_definitions = "[ ${module.container_definition.json_map} ]"
57-
task_role_arn = aws_iam_role.ecs_task_execution_role.arn
57+
task_role_arn = var.task_role_arn == null ? aws_iam_role.ecs_task_execution_role.arn : var.task_role_arn
5858
execution_role_arn = aws_iam_role.ecs_task_execution_role.arn
5959
network_mode = "awsvpc"
6060
dynamic "placement_constraints" {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ variable "port_mappings" {
177177
]
178178
}
179179

180+
variable "task_role_arn" {
181+
description = "(Optional) The ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services. If not specified, `aws_iam_role.ecs_task_execution_role.arn` is used"
182+
type = string
183+
default = null
184+
}
185+
180186
variable "readonly_root_filesystem" {
181187
description = "(Optional) Determines whether a container is given read-only access to its root filesystem. Due to how Terraform type casts booleans in json it is required to double quote this value"
182188
type = bool

0 commit comments

Comments
 (0)