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

Feature Request: Support prefix on policy name #239

Closed
davidaah opened this issue Apr 26, 2022 · 4 comments · Fixed by #243
Closed

Feature Request: Support prefix on policy name #239

davidaah opened this issue Apr 26, 2022 · 4 comments · Fixed by #243

Comments

@davidaah
Copy link

Is your request related to a new offering from AWS?

No

Is your request related to a problem? Please describe.

We have specific naming convention requirements for roles and policies which is preventing us from being able to adopt this module. Role name prefix was added previously #101 but a similar feature is not available for Policy name prefix.

I may be able to contribute this back, but confirm there was buy-in in the first place to add it (along with the preferred approach, see two variations listed below).

Describe the solution you'd like.

Ideally a new (optional) variable would be added for a policy name prefix to either completely override the current value of name_prefix in aws_iam_policy or just provide a value which is pre-pended to the default

For example either of the following would be fine:

resource "aws_iam_policy" "cluster_autoscaler" {
  count = var.create_role && var.attach_cluster_autoscaler_policy ? 1 : 0

  name_prefix = "${var.policy_name_prefix}AmazonEKS_Cluster_Autoscaler_Policy-"
...

}

or

resource "aws_iam_policy" "cluster_autoscaler" {
  count = var.create_role && var.attach_cluster_autoscaler_policy ? 1 : 0

  name_prefix = var.policy_name_prefix
...

}

It's unclear to me the viability of the second option, in the case where the role needs to attach multiple policies the consumer would only be able to specify a single prefix and may lose some of the niceties of having something in the policy name which describes what the policy is for. As of now, i think this module only attaches one policy per role so that may be a non-issue in the short term.

Describe alternatives you've considered.

The only available option right now would be to fork the module and exposing this configuration

Additional context

N/A

cvockrodt pushed a commit to cvockrodt/terraform-aws-iam that referenced this issue May 3, 2022
cvockrodt pushed a commit to cvockrodt/terraform-aws-iam that referenced this issue May 3, 2022
cvockrodt pushed a commit to cvockrodt/terraform-aws-iam that referenced this issue May 3, 2022
cvockrodt pushed a commit to cvockrodt/terraform-aws-iam that referenced this issue May 3, 2022
bryantbiggs pushed a commit that referenced this issue May 3, 2022
antonbabenko pushed a commit that referenced this issue May 3, 2022
## [4.24.0](v4.23.0...v4.24.0) (2022-05-03)

### Features

* add policy_name_prefix for IRSA policies ([#243](#243)) ([d932f65](d932f65)), closes [#239](#239)
@antonbabenko
Copy link
Member

This issue has been resolved in version 4.24.0 🎉

@davidaah
Copy link
Author

davidaah commented May 3, 2022

This is awesome... thanks @bryantbiggs @antonbabenko !!

@bryantbiggs
Copy link
Member

@davidaah you're welcome! If you enjoy the modules we've created please give them a ⭐ and have your friends give them a ⭐ - and if your organization uses the modules to run their infrastructure, have them consider supporting through sponsorship. Cheers!

@github-actions
Copy link

github-actions bot commented Nov 8, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants