-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
google_project_default_service_accounts Cleaned up the whole IAM #7871
google_project_default_service_accounts Cleaned up the whole IAM #7871
Comments
@Clausewitz45 as doc says, Doc: Config
|
@venkykuberan many thanks for the feedback, but this wasn't the main problem. The main problem was that not just the default service accounts were cleaned up, but everything. During the Terraform apply, all users, groups, custom service accounts have been deprivileged which means that either the documentation is inaccurate or something is wrong with the resource. From the documentation:
I cannot see here that everything will be deprivileged. |
@venkykuberan: Do you mind verifying whether or not you see the same behaviour, where non-default-SA IAM bindings/members are affected? |
@rileykarson I don't see any non-default SAs/users are affected on my end by that resource. |
I read the code wrong 😞 . This looks like it should work, I'll have to manually test to verify. To confirm, @Clausewitz45 you're saying that applying the resource with |
@slevenick: The default service accounts this resource covers are specifically the same-project ones of which there are exactly two, I think? GCE and AppEngine: https://github.com/hashicorp/terraform-provider-google-beta/blob/master/google-beta/resource_google_project_default_service_accounts.go#L207-L208 |
Ah, yeah it looks like we list all service accounts and remove permissions from them: https://github.com/GoogleCloudPlatform/magic-modules/blob/master/third_party/terraform/resources/resource_google_project_default_service_accounts.go#L169 That can't be right |
That list gets filtered: https://github.com/GoogleCloudPlatform/magic-modules/blob/master/third_party/terraform/resources/resource_google_project_default_service_accounts.go#L147-L158 While you're in the resource, we could inline a whole bunch of the code to make it clearer to read. |
@slevenick Yes, I can confirm, after running |
Yeah, I've got a fix for this coming. There is definitely a bug with |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
google_project_default_service_accounts
Terraform Configuration Files
Expected Behavior
Remove all privileges from default service accounts only.
Actual Behavior
Maybe I was missing something from the documentation or misunderstood the behavior of the resource, but after applying the plan, it completely cleared up the IAM project policies, except the inherited permissions. Removed every single piece from there, not just from the default service accounts, but revoked the permissions from ALL user/group/service accounts.
After my panic, I was deleting the resource, but the restore doesn't happened. I had to restore the default privileges of all GCP SA accounts:
Before this script (18 projects... Yes, I know, why I was not try in a single one),
terrafrom plan
is failed. After this script - I was able to run bothterraform plan
andterraform apply
.Steps to Reproduce
terraform apply
The text was updated successfully, but these errors were encountered: