-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
read/write iam policies at version 3 in GA provider #3003
read/write iam policies at version 3 in GA provider #3003
Conversation
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesWARNING: The following files changed in commit 073ced6 may need corresponding changes in third_party/validator:
No diff detected in terraform-provider-google-beta. New Pull RequestsI built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to preserve the existing IAM policy version if it exists? And only set version 3 if the policy is already version 3 or they specify a condition?
It seems like we are creating a situation where downgrading the provider will be impossible for users with any IAM resources, but that might be inevitable
Versions are actually computed based on the content of the policy, so if you set it as 3, it doesn't contain any conditions, and then read it as 3, it'll say it's 1: https://cloud.google.com/iam/docs/policies#specifying-version (there's an example under the setting the policy section, scenario 1) |
Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec.
073ced6
to
4cd86cc
Compare
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff |
Conditions will still only be able to be set in the beta provider, but this way we don't end up in situations where people are stuck because they're only managing part of their IAM in terraform, and the part that doesn't has a condition, so the policy version is 3 but we're reading at 1. Fixes hashicorp/terraform-provider-google#5218, which explains the problem a bit better.
This also makes sure that the changes outlined in b/147505583 won't affect us.
Tested by adding a member with a condition to a role in the console, and then using Terraform to add another member to the same role, but with no condition.
Technically this would break users that have an IAM binding resource defined in their config, have modified it out of band to have a condition on it, upgrade to the version with this change, and then modify the member list. Since those users should be using the beta provider and defining the condition in their config anyway, I'm not too worried about it.
Release Note Template for Downstream PRs (will be copied)