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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclusive management of inline & managed policies for IAM users #17512

Open
YakDriver opened this issue Feb 8, 2021 · 1 comment
Open

Exclusive management of inline & managed policies for IAM users #17512

YakDriver opened this issue Feb 8, 2021 · 1 comment
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.

Comments

@YakDriver
Copy link
Member

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 user.

New or Affected Resource(s)

  • aws_iam_user

Potential Terraform Configuration

resource "aws_iam_user" "example" {
  name          = "yak_user"
  inline_policy = []
}

resource "aws_iam_user" "example" {
  name = "yak_user"

  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_user" "example" {
  name                = "yak_user"
  managed_policy_arns = [aws_iam_policy.policy_one.arn, aws_iam_policy.policy_two.arn]
}

References

@ChaseFreeman17
Copy link

ChaseFreeman17 commented Aug 23, 2022

I would love to see this prioritized higher, until this is implemented drift will not show when managed policies or inline policies are attached to a IAM User outside of Terraform.

Basically if we see "aws_iam_user_policy_attachment" resource block we consider that as risk to our IaC as it will not drift properly.

I think the implementation of #17510 is exactly what is needed for users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Development

No branches or pull requests

2 participants