-
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 throws an error if org policy skipDefaultNetworkCreation is enforced #3582
google_project throws an error if org policy skipDefaultNetworkCreation is enforced #3582
Comments
The error is happening because the network is always created when a project is created, but if If you omit that field I believe the project creation should succeed. If it does I'll update the documentation to reflect that. |
I just ran into this as well. Removing |
As seen in hashicorp/terraform-provider-google#3582, it is now possible to set an organization policy that removes the default network from a project when it's created. This means it's now possible that Terraform's attempt to delete that default network will encounter an error saying the network is not found. Because what Terraform wanted was achieved, even if not by Terraform, we shouldn't raise that error, we should ignore it.
So it sounds to me like what's happening here is:
I've opened GoogleCloudPlatform/magic-modules#2117 to resolve this by catching the error and ignoring it. If I've misunderstood the situation, I'm happy to try a different solution, I'll just need more details. :) |
That's exactly what was happening. |
As seen in hashicorp/terraform-provider-google#3582, it is now possible to set an organization policy that removes the default network from a project when it's created. This means it's now possible that Terraform's attempt to delete that default network will encounter an error saying the network is not found. Because what Terraform wanted was achieved, even if not by Terraform, we shouldn't raise that error, we should ignore it.
This has been merged and should be fixed in the next release. |
@paddycarver I'm still seeing this error occur with v2.13.0: Terraform version:
Error:
|
I'll take a look! |
I´m having a similar issue Terraform v0.12.6
Error: Error deleting default network in project tf-billing08: Error waiting for Deleting Network: error while retrieving operation: Get https://www.googleapis.com/compute/v1/projects/tf-billing08/global/operations/operation-1566914277192-59119a8e2b16e-5837383f-f7835950?alt=json&prettyPrint=false: net/http: request canceled (Client.Timeout exceeded while awaiting headers) The link says: Do I missing something, like a dependence on provider resource to create a projet? |
@chrisst I just hit this and wound up with the project created in Google but marked as tainted in the terraform state. When I planned again it wanted to destroy/recreate the project. I let it proceed and it failed:
This is a showstopper. Is there any alternative to creating projects outside of terraform and importing them? |
@eriksw have you tried removing |
@chrisst Leaving it unset allows project creation via terraform to succeed. It's worrying to see that |
@eriksw we will leave this bug open until you don't have to use |
Drive-by: I'm not convinced all the errors around this are the same issue, but I think some of them would be fixed by using errwrap.Wrapf at https://github.com/terraform-providers/terraform-provider-google/blob/master/google/resource_google_project.go#L459 so that we can later parse it as a googleapi.error and see whether it's a 404 |
@danawillow @chrisst @paddycarver Is there an ETA for fixing this? It's very confusing behavior and also represents a regression from previous fixes. |
Sorry for the delay, looks like this fell through the cracks again. @ALL Once this is merged this issue will auto close again, but let me know if there is a scenario I haven't caught yet and I'll reopen. |
@chrisst Did this make it into the 3.8.0 release, or do we need to wait for the next one? |
Looks like it missed the 3.8.0 release, but it did make it into the 3.9.0 release. It got missed in the changelog generation, adding it back in via #5707 |
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
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Project without default network should be created.
Actual Behavior
Project is created with the following error
Steps to Reproduce
terraform apply
Important Factoids
Very important!
In order to reproduce this issue you need to do:
constraints/compute.skipDefaultNetworkCreation
toEnforced
either on org level or on the folder levelauto_create_network = false
References
The text was updated successfully, but these errors were encountered: