terraform-aws-iam icon indicating copy to clipboard operation
terraform-aws-iam copied to clipboard

how to create inline policy w with assumable role

Open kapil1699 opened this issue 3 years ago β€’ 6 comments

I want to create inline policy with assumable role.

Currently,i see it only supports custom policy arn not inline policy JSON.

Could you please how to create inline policy with assumable role.

My IAM role contains customer managed policy ,aws managed policyband inlinepolicy.

Current module setup only supporting aws and customer mananged policy.

Please suggest.

kapil1699 avatar Jul 22 '22 14:07 kapil1699

@kapil1699 specifically what module are you talking about here?

max-rocket-internet avatar Jul 22 '22 16:07 max-rocket-internet

@max-rocket-internet : I am using below module reference.

modules/iam-assumable-role/main.tf

kapil1699 avatar Jul 23 '22 05:07 kapil1699

Doesn't seem possible atm with the iam-assumable-role. Would be great to have some variable like:

variable "inline_policies" {
  description = "A map of json policies with key = inline_policy_name and value = policy_json"
  type        = map(string)
}

@kapil1699 Currently, the workaround would be to use aws_iam_role_policy to attach the inline policy:

resource "aws_iam_role_policy" "inline_policy" {
  name   = "inline-policy"
  role   = module.created_from_iam_assumable_role.iam_role_name
  policy = <your-policy-json>
}

tomcruz17 avatar Jul 23 '22 09:07 tomcruz17

Can we take this as feature request if it is not possible with current state.

As this is expected for any iam assumable role to have aws managed, customer manage and inline policy in same role.

Any other suggestion appriecated.

kapil1699 avatar Jul 23 '22 16:07 kapil1699

also interested in this feature! +1

mulebm avatar Aug 16 '22 15:08 mulebm

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] avatar Sep 16 '22 00:09 github-actions[bot]

This issue was automatically closed because of stale in 10 days

github-actions[bot] avatar Sep 27 '22 00:09 github-actions[bot]

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[bot] avatar Nov 08 '22 02:11 github-actions[bot]