-
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
Set google_service_account IAM-related fields during plan stage #11929
Set google_service_account IAM-related fields during plan stage #11929
Conversation
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @melinath, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
Did some local tests and it appears to be working as intended:
|
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.
Thanks for your contribution & patience; apologies for the delayed review. This is a slightly unusual contribution that we don't have a lot of precedent for so I'm going to check with teammates about whether there's anything specific to look out for here.
I've left a couple comments down below in the meantime. No worries if you'd prefer to wait to hear if there are any blockers before proceeding.
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account.go
Outdated
Show resolved
Hide resolved
Tests analyticsTotal tests: 147 Click here to see the affected service packages
🟢 All tests passed! View the build log |
Tests analyticsTotal tests: 147 Click here to see the affected service packages
🟢 All tests passed! View the build log |
@melinath This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
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.
We're okay with this change in a general sense. I'm double-checking to make sure that it's safe for us to always assume the service account will have the expected format. (I think it should be?)
note to self: yaqs/6281398878809882624.
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account.go
Outdated
Show resolved
Hide resolved
Regarding the failed TGC tests - you'll need to account for the fact that references to service account emails are known before apply in two files:
|
It looks like TGC already has custom logic to add the email into the API object (to get around the fact it's missing in the plan): https://github.com/GoogleCloudPlatform/terraform-google-conversion/blob/aa4f4879b9078957d64d3dc68342817020601124/tfplan2cai/converters/google/resources/services/resourcemanager/service_account.go#L104-L107 So at least the person who made that change also thought that was safe to compute ahead of time. |
The format for the service account is documented here: https://cloud.google.com/iam/docs/service-accounts-create#creating so it should definitely be safe to precompute as long as the universe_domain is |
@mikesmitty, this PR is waiting for action from you. If no action is taken, this PR will be closed in 28 days. Please address any comments or change requests, or re-request review from a core reviewer if no action is required. This notification can be disabled with the |
Thanks for the tips, I'll be back to work on this in a bit |
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.
ah, thanks! I don't have any updates on a "reusable function" but config.UniverseDomain
is where you can check whether it's in the standard universe domain I mentioned above.
b8baf66
to
1c4d7c0
Compare
chore: add fallback project id to test case
@melinath I added a basic reusable function to get the UniverseDomain since I wasn't sure what other use cases there might be for it. I'm open to suggestions if you had something else in mind however |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 4303 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_test.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_test.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_test.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/resourcemanager/resource_google_service_account_test.go
Outdated
Show resolved
Hide resolved
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
ErrorsOther:
|
/gcbrun |
@melinath This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 4322 Click here to see the affected service packages
Action takenFound 8 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
The test failures are unrelated. |
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.
LGTM - I did some additional manual testing and this seems to work as I'd expect. Thanks for sticking with this and adding thorough tests!
This sets the IAM-related fields on
google_service_account
with CustomizeDiff so they won't be "known after apply" and can be used to set IAM rules in a single TF run. I couldn't find any existing issues around it, but it has been a thorn in my side for a while.Release Note Template for Downstream PRs (will be copied)