Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for IAM task role policy path in ECS service module #265

Open
partlythomas opened this issue Mar 17, 2025 · 4 comments
Open

Comments

@partlythomas
Copy link

Describe the solution you'd like.

Similar to how the ECS service module has variable task_exec_iam_policy_path for task execution IAM policies, it would be meaningful to support the same path specification for the IAM tasks role policies as well.

For example as a variable named tasks_iam_policy_path

The variable should then be implemented at resource "aws_iam_role_policy" "tasks" using the path attrribute.

https://github.com/terraform-aws-modules/terraform-aws-ecs/blob/master/modules/service/variables.tf

@partlythomas
Copy link
Author

Update: I realize the proposed feature is not compatible with the use of aws_iam_role_policy resource that the module uses for the policy today. I will prepare a Pull Request proposal using the aws_iam_policy resource and explicit attachment resource which is more closely aligned with the pattern that the ECS task execution role uses in the module.

@partlythomas
Copy link
Author

partlythomas commented Mar 17, 2025

Proposed PR related to this issue:
#268

@bryantbiggs
Copy link
Member

why do we need all of this just so that a path can be set?

@partlythomas
Copy link
Author

@bryantbiggs Because you can't set path for the inline policy type, as it is not an actual separate resource in AWS, but just a part of the role. If you want to separate path for the role and the policy, it can be done so with the proposed changes.

The actual case for this is in environments where governance policies dictates that roles and policies must be created with specific paths. It's sort-of an edge-case, but the changes proposed also aligns with the pattern used by the ECS Task execution role and policy, so for the wider audience that would be the main motivation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants