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

Exclusive management of inline & managed policies for IAM roles #17510

Closed
YakDriver opened this issue Feb 8, 2021 · 1 comment · Fixed by #5904
Closed

Exclusive management of inline & managed policies for IAM roles #17510

YakDriver opened this issue Feb 8, 2021 · 1 comment · Fixed by #5904
Labels
enhancement Requests to existing resources that expand the functionality or scope. partition/aws-us-gov Pertains to the aws-us-gov partition. service/iam Issues and PRs that pertain to the iam service.
Milestone

Comments

@YakDriver
Copy link
Member

YakDriver commented Feb 8, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Descends from #4426

Description

Add feature to revert out-of-band changes to attached (managed) and inline policies associated with an IAM role.

New or Affected Resource(s)

  • aws_iam_role

Potential Terraform Configuration

resource "aws_iam_role" "example" {
  name               = "yak_role"
  assume_role_policy = data.aws_iam_policy_document.instance_assume_role_policy.json # (not shown)
  inline_policy      = []
}

resource "aws_iam_role" "example" {
  name               = "yak_role"
  assume_role_policy = data.aws_iam_policy_document.instance_assume_role_policy.json # (not shown)

  inline_policy {
    name = "my_inline_policy"

    policy = <<EOF
{
  "Statement": [
    {
      "Action": [
        "ec2:Describe*"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ],
  "Version": "2012-10-17"
}
EOF
  }

  inline_policy {
    name   = "policy-8675309"
    policy = data.aws_iam_policy_document.inline_policy.json
  }
}

resource "aws_iam_role" "example" {
  name                = "yak_role"
  assume_role_policy  = data.aws_iam_policy_document.instance_assume_role_policy.json # (not shown)
  managed_policy_arns = [aws_iam_policy.policy_one.arn, aws_iam_policy.policy_two.arn]
}

References

@YakDriver YakDriver added the enhancement Requests to existing resources that expand the functionality or scope. label Feb 8, 2021
@ghost ghost added the service/iam Issues and PRs that pertain to the iam service. label Feb 8, 2021
@YakDriver YakDriver added the partition/aws-us-gov Pertains to the aws-us-gov partition. label Feb 8, 2021
@github-actions github-actions bot added this to the v3.30.0 milestone Feb 23, 2021
@YakDriver YakDriver modified the milestones: v3.30.0, v3.29.1 Feb 24, 2021
@ghost
Copy link

ghost commented Mar 25, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. partition/aws-us-gov Pertains to the aws-us-gov partition. service/iam Issues and PRs that pertain to the iam service.
Projects
None yet
1 participant