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

providers/google: equivalent IAM policies are treated as different #11763

Closed
paddycarver opened this issue Feb 8, 2017 · 1 comment · Fixed by #12387
Closed

providers/google: equivalent IAM policies are treated as different #11763

paddycarver opened this issue Feb 8, 2017 · 1 comment · Fixed by #12387

Comments

@paddycarver
Copy link
Contributor

Terraform Version

0.8.5, 0.8.6, master

Affected Resource(s)

  • google_project_iam_policy

Terraform Configuration Files

resource "google_project_iam_policy" "google-project" {
  project       = "${var.gcp_project}"
  policy_data   = "${data.google_iam_policy.policy-bindings.policy_data}"
  authoritative = false
}

data "google_iam_policy" "policy-bindings" {
  binding {
    role = "roles/viewer"

    members = [
      "user:[email protected]",
    ]
  }

  binding {
    role = "roles/viewer"

    members = [
      "user:[email protected]",
    ]
  }
}

Expected Behavior

After applying this, there should be no diff for terraform plan.

Actual Behavior

After applying this, there's a diff on terraform plan:

    policy_data: "{\"bindings\":[{\"members\":[\"user:[email protected]\",\"user:[email protected]\"],\"role\":\"roles/viewer\"}]}" => "{\"bindings\":[{\"members\":[\"user:[email protected]\"],\"role\":\"roles/viewer\"},{\"members\":[\"user:[email protected]\"],\"role\":\"roles/viewer\"}]}"

Steps to Reproduce

  1. terraform apply
  2. terraform plan

This is just a matter of getting the DiffSuppressFunc to collapse/expand policies as much as possible before comparing them, which will give us a common representation.

@paddycarver paddycarver self-assigned this Feb 8, 2017
paddycarver added a commit that referenced this issue Mar 2, 2017
When comparing the config and state for google_project_iam_policy,
always merge the bindings down to a common representation, to avoid a
perpetual diff.

Fixes #11763.
@ghost
Copy link

ghost commented Apr 15, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant