terraform-aws-ecs-alb-service-task icon indicating copy to clipboard operation
terraform-aws-ecs-alb-service-task copied to clipboard

Changing `task_exec_policy_arns` or `task_policy_arns` cause recreations

Open nitrocode opened this issue 3 years ago • 0 comments

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

The resource aws_iam_role_policy_attachment uses count logic instead of a for_each which causes deletions and creations of attachments when adding or removing policies.

https://github.com/cloudposse/terraform-aws-ecs-alb-service-task/blob/07cd6ae9a3e79fe7cbc2ade37fb0e2b5f1b67c19/main.tf#L287-L291

https://github.com/cloudposse/terraform-aws-ecs-alb-service-task/blob/07cd6ae9a3e79fe7cbc2ade37fb0e2b5f1b67c19/main.tf#L160-L164

If a for_each is used instead, this will prevent deleting and recreating all the attachments.

nitrocode avatar Jul 06 '22 16:07 nitrocode