Skip to content

Commit 06da349

Browse files
authored
Add extra task policies (#41)
* Add extra task policies Co-authored-by: lzrocha <lzrocha@users.noreply.github.com>
1 parent 6d85360 commit 06da349

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ module "ecs_apps" {
101101
| efs\_lifecycle\_transition\_to\_primary\_storage\_class | Option to enable EFS Lifecycle Transaction to Primary Storage Class | `bool` | `false` | no |
102102
| enable\_schedule | Enables schedule to shut down and start up instances outside business hours. | `bool` | `false` | no |
103103
| extra\_certificate\_arns | Extra ACM certificates to add to ALB Listeners | `list(string)` | `[]` | no |
104+
| extra\_task\_policies\_arn | Extra policies to add to the task definition permissions | `list(string)` | `[]` | no |
104105
| fargate\_only | Enable when cluster is only for fargate and does not require ASG/EC2/EFS infrastructure | `bool` | `false` | no |
105106
| instance\_types | Instance type for ECS workers | `list(any)` | `[]` | no |
106107
| instance\_volume\_size | Volume size for docker volume (in GB). | `number` | `30` | no |

_variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,4 +354,10 @@ variable "efs_lifecycle_transition_to_primary_storage_class" {
354354
type = bool
355355
default = false
356356
description = "Option to enable EFS Lifecycle Transaction to Primary Storage Class"
357+
}
358+
359+
variable "extra_task_policies_arn" {
360+
type = list(string)
361+
default = []
362+
description = "Extra policies to add to the task definition permissions"
357363
}

iam-ecs-task.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,9 @@ resource "aws_iam_role_policy" "s3_policy" {
8888
}
8989
EOF
9090
}
91+
92+
resource "aws_iam_role_policy_attachment" "extra_task_policies_arn" {
93+
for_each = toset(try(var.extra_task_policies_arn, []))
94+
role = aws_iam_role.ecs_task.name
95+
policy_arn = each.key
96+
}

0 commit comments

Comments
 (0)