-
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
Add IAM Conditions support; enable it in service account IAM #2372
Add IAM Conditions support; enable it in service account IAM #2372
Conversation
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNo diff detected in terraform-google-conversion. 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. |
@danawillow Can I ask which resources are broken? Our primary use case for wanting IAM conditions is to be able to set access permissions on GCS buckets that apply to entire prefixes rather than either entire buckets or only specific objects (e.g. everything under Apologies if this would be better on hashicorp/terraform-provider-google#2909, let me know if so and I'll move it there. |
@dancmeyers, the only resources I've played around with so far are service accounts (which work) and pubsub subscriptions (which don't seem to). |
97c97a6
to
e943dc2
Compare
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
|
||
* `description` - (Optional) An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. | ||
|
||
~> **Warning:** Terraform considers the `role` and condition contents (`title`+`description`+`expression`) as the |
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.
Do we want description
as part of the identifier for the binding?
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.
Yes and no. It feels silly to do so, but it also makes the code much easier to deal with, and it aligns with what the IAM team has told us (since there can be two distinct conditions with the exact same title and expression but different descriptions). Since a ForceNew on an IAM resource isn't super destructive, I'm pretty ok with leaving it this way and seeing if it causes any issues.
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
e95eb91
to
2ceff33
Compare
Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec.
Part of hashicorp/terraform-provider-google#2909.
This adds the conditions properties to all IAM resources (except, I think,
google_project_iam_policy
because that one does its own thing). To keep this PR from getting too unwieldy (and because certain resources seem to be broken), I've only enabled and documented it in the service account IAM resources. Technically this means that if this change is released on its own, people will be able to set the conditions field in other IAM resources, but it would fail at apply-time because we didn't set the version to 3. I think this is fine, but if we don't want that to happen we can time this PR with any follow-ups so they appear in a release together.This change also adds a bunch of the scaffolding to the GA provider without adding full support for the feature, mainly to limit the number of erb tags in the code. Let me know if that's confusing and I can adjust.
The other confusing behavior is around users who have changed IAM conditions out-of-band. We
have no way to know whether a given binding with no condition (and no equivalent binding upstream but one with a condition upstream) had a condition added out-of-band (and thus TF should clobber the condition) or if it is intentionally being created as one with no conditions (and thus TF should add a new binding with no conditions). That, combined with the fact that we allow bindings with no members, leads to some weird diffs:
Config:
If I add a condition out of band, I get this diff:
If applied, this would add a new binding with this member list and no condition, and leave the one with the condition no longer managed by TF.
If I add a condition out of band, then add it to my config as such:
Then the diff looks like this:
And applying it is effectively a no-op.
I've been staring at this for too long and could use some fresh eyes to see if there's a way to improve this UX. @emilymye, any chance you'll have time before your break to do a thorough review?
Release Note Template for Downstream PRs (will be copied)