hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.17k forks source link

Terraform tells there are change with unmodified role inline policy imported from a file #12853

Open Porkepix opened 4 years ago

Porkepix commented 4 years ago

Community Note

Terraform Version

Terraform version: v0.11.14 Provider version: 2.57

Affected Resource(s)

Terraform Configuration Files

resource "aws_iam_role" "my_role_name" {
  name               = "my_role_name"
  assume_role_policy = "${file("assume-role-policy.json")}"
}

Expected Behavior

Without change on the json policy file, no change should happen.

Actual Behavior

Terraform actually tells on every run that there are changes on the roles and rewrite the inline policy… identically as what was already there.

Steps to Reproduce

  1. Create a role similarly to the code above, with a valid .json policy such as the one below.
  2. Run terraform apply twice

Policy:

{
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Effect": "Allow",
      "Principal": {
      "AWS": "account_id"
      }
    }
  ]
}
justinretzolk commented 3 years ago

Hey @Porkepix 👋 Thank you for taking the time to file this. Given that there's been a number of Terraform and AWS Provider releases since you initially filed it, can you confirm whether you're still experiencing this behavior?

avanzelli commented 1 year ago

Sorry for resurrecting this thread, but I'm currently having this problem.

My Version is:

terraform version Terraform v1.5.5 on darwin_amd64

justinretzolk commented 1 year ago

Hey @avanzelli 👋 Can you run terraform -v after initializing the directory so that we can see what version of the AWS provider you're running as well?