Open periwinkleFTW opened 1 year ago
@periwinkleFTW not sure how much the provider can do for this. This is how the gcp internal works. Unless we know exactly what to send to the api, there is little the provider can do.
@melinath seems like it's not a provider issue
Just to make sure I understand this right, it sounds like the problem is that the API gateway can't be deleted because it has things inside it which would need to be deleted first (or we would need to either always force a cascading delete or provide a deletion_policy
field).
But this error doesn't show up until Terraform tries to delete the project containing the API gateway, and that makes the project deletion fail.
And at that point, the project becomes completely inaccessible, either for changing IAM permissions or deleting it, because of an "Unknown Error", even for users in Cloud Console who have appropriate permissions to access, modify, or delete projects in the entire org.
Is that accurate?
@melinath that is correct
@melinath @edwardmedia I have an update. It seems that destroying the project with api gateway resources that are not managed by terraform creates a zombie project because terraform disables GCP API services that API gateway relies on while api config/gateway are still there. I managed to get inside the zombie and when going into the 'API Gateway' I saw that 2 out of 3 GCP API services were disabled (bottom ones). Upon enabling those API services I was able to manually delete the API gateway
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
Terraform v1.4.6 on darwin_amd64
Affected Resource(s)
google_apigateway*
Terraform Configuration Files
Debug Output
I dont know how to get debug output on Terraform Cloud
Panic Output
Error: Error when reading or editing Api: googleapi: Error 400: Resource '"projects/andrey-dev-project-07dd/locations/global/apis/andrey-dev-seeder-api-07dd"' has nested resources. If the API supports cascading delete, set 'force' to true to delete it and its nested resources.
Expected Behavior
I expected an error before terraform starts deleting resources and APIs or for terraform to nuke the project and all the resources. I would be ok with either option
Actual Behavior
Terraform deletes a lot of resources and disables a lot of APIs. It is impossible to get back into the project because even attempting to deploy IAM permissions for my account errors out
Steps to Reproduce
Deploy a project, enable API gateway service. Deploy API using terraform, deploy config and gateway manually. Run destroy
terraform apply
Important Factoids
After this error a zombie project is created. It is impossible to delete this project because console shows
Unknown Error
pop up when trying to delete the project (I haveProject Deleter
perms in the org).I use TF Cloud to manage infrastructure.
Terraform configuration handles project creation, enabling of API, and deployment of resources.
Similar deletion behaviour occurred with VPC (https://issuetracker.google.com/issues/186792016) but this bug is resolved by nuking the whole project (sometimes takes 2-3 tries to delete the project though)
References
0000
b/299600741