-
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
CloudSQL behavior change v3.44.0 #7595
CloudSQL behavior change v3.44.0 #7595
Comments
It seems probable that the service networking check from GoogleCloudPlatform/magic-modules#3954 is overtuned. |
Hmm That is very unlikely to happen if you are using Shared VPC. That error appears if the identity running terraform is missing https://cloud.google.com/sql/docs/mysql/private-ip#api_and_iam_requirements That first err check should have a been less aggresive. |
As far as I can tell the identity running this code only has I am early in my GCP learning so it is likely I've laid this out in an unexpected way, but I still would not expect the usage to change in this way given the version bump. Please let me know if I must expand IAM permissions to ensure this works smoothly or this behavior changed will be addressed in the provider. Thanks! |
@jimmydurkin: I've got a fix, but I'd like to test it against this exact case before submitting it. Does this reproduction sound right? You're using Terraform with some service account It's my understanding |
If foo has browser role then that error shouldn't appear. https://cloud.google.com/resource-manager/reference/rest/v1/projects/get
|
https://gist.github.com/jimmydurkin/1e2eb317ea1ed7b220d7bfca785d8985#file-gistfile1-txt-L294 The GET call shouldn't fail if the identity has browser on the redacted project. Please double check the permissions. |
@upodroid: We still want to reduce the permissions required regardless- requiring additional permissions is a breaking change. I believe it was possible in prior versions to only have |
The fix would be to change https://github.com/hashicorp/terraform-provider-google/blob/master/google/resource_sql_database_instance.go#L660 660 to match the same as 666 When I wrote that, I assumed that the identity would atleast have |
Sorry. yes @upodroid you are correct, the service project owner identity that we use to run this code has no roles in the host vpc project. i found this command so if it can be trusted there are no permissions granted to this user in the networking host project. gcloud beta asset search-all-iam-policies --scope=organizations/orgid --query="[email protected]"
---
policy:
bindings:
- members:
- serviceAccount:[email protected]
role: roles/cloudbuild.builds.editor
- members:
- serviceAccount:[email protected]
role: roles/owner
- members:
- serviceAccount:[email protected]
role: roles/viewer
project: projects/cloudbuild-project
resource: //cloudresourcemanager.googleapis.com/projects/cloudbuild-project
---
policy:
bindings:
- members:
- serviceAccount:[email protected]
role: roles/owner
project: projects/service-project
resource: //cloudresourcemanager.googleapis.com/projects/service-project
---
policy:
bindings:
- members:
- serviceAccount:[email protected]
role: roles/browser
project: projects/gke-host-project
resource: //cloudresourcemanager.googleapis.com/projects/gke-host-project
---
policy:
bindings:
- members:
- group:[email protected]
role: roles/iam.serviceAccountTokenCreator
project: projects/service-project
resource: //iam.googleapis.com/projects/service-project/serviceAccounts/[email protected] |
So how do you create VMs in the service project using the network from Shared VPC? |
We do not currently create VMs in the shared VPC from the service projects. Our gke host project(which does have network roles) provides the compute for our workloads |
@jimmydurkin, just to clarify your environment once again: the host and service project are already established, and the shared network is already set up on both the host and service side. And your service account has no roles at all on the host project? From your config above, Sorry for the back and forth! I'd assumed networkUser (which grants projects.get) was required on the host, but https://cloud.google.com/sql/docs/mysql/private-ip#api_and_iam_requirements indicates that it isn't. edit: Ah, never mind, I seem to have gotten it! |
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 👉 [email protected]. 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)
Terraform Configuration Files
Debug Output
https://gist.github.com/jimmydurkin/1e2eb317ea1ed7b220d7bfca785d8985
Panic Output
Expected Behavior
This code snippet works on 3.43 and provisions our database
Actual Behavior
After accepting the plan an error is thrown
Steps to Reproduce
terraform apply
Important Factoids
This service account that runs this belongs to a different project than the shared vpc. It has minimal permissions.
References
The text was updated successfully, but these errors were encountered: