Skip to content

Can't provide different name_prefix value for the IAM Policy #3335

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

Closed
Pavankumar66 opened this issue Apr 6, 2025 · 1 comment
Closed

Can't provide different name_prefix value for the IAM Policy #3335

Pavankumar66 opened this issue Apr 6, 2025 · 1 comment

Comments

@Pavankumar66
Copy link

Pavankumar66 commented Apr 6, 2025

Description

We have a requirement to use different name_prefix value for IAM role and IAM policy. Currently the module doesn't offer this.

Versions

  • Module version [Required]: 20.35.0

Expected behavior

should have an additional variable to specify the IAM Policy name prefix value. This will remove the dependency on the name_prefix value for the IAM role.

name_prefix = var.iam_role_use_name_prefix ? "${local.iam_role_name}${var.prefix_separator}" : null

Actual behavior

name_prefix is configured to take the iam_role_name value and there is no seperate variable for the iam policy name prefix.

resource "aws_iam_role" "this" {
  count = local.create_iam_role ? 1 : 0

  name        = var.iam_role_use_name_prefix ? null : local.iam_role_name
  name_prefix = var.iam_role_use_name_prefix ? "${local.iam_role_name}${var.prefix_separator}" : null
  path        = var.iam_role_path
  description = var.iam_role_description

  assume_role_policy    = data.aws_iam_policy_document.assume_role_policy[0].json
  permissions_boundary  = var.iam_role_permissions_boundary
  force_detach_policies = true

  tags = merge(var.tags, var.iam_role_tags)
}
@bryantbiggs
Copy link
Member

you will need to provider either your own role or policy in order to reach your desire outcome - we are not looking to add more variables for niche edge cases

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

No branches or pull requests

2 participants