-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix auto-delete default network in google_project. #1336
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
Conversation
Test is failling because the default network is created with 4 default firewall rules and these have to be deleted before we can delete the network: --- FAIL: TestAccProject_deleteDefaultNetwork (118.51s)
testing.go:513: Step 0 error: Error applying: 1 error(s) occurred:
* google_project.acceptance: 1 error(s) occurred:
* google_project.acceptance: The network resource 'projects/terraform-619kodgqiy/global/networks/default' is already being used by 'projects/terraform-619kodgqiy/global/firewalls/default-allow-rdp' |
Ah, dang, that's totally my fault for not testing my code. I see the test failure but I'll take it from here if you like, no reason for you to keep working fixing my mistake. |
@@ -195,9 +195,12 @@ func resourceComputeNetworkDelete(d *schema.ResourceData, meta interface{}) erro | |||
return err | |||
} | |||
|
|||
// Delete the network | |||
return deleteComputeNetwork(project, d.Id(), config) |
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.
You'll still want a d.SetId("") if err == nil, right?
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.
The d.SetId("")
is actually redundant: https://github.com/hashicorp/terraform/blob/master/helper/schema/resource.go#L205
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.
I did not know that!
--- PASS: TestAccProject_deleteDefaultNetwork (206.61s) @ndmckinley tests are passing. PTAL |
* Use projectId and enable required compute API * Delete firewall rules before deleting default network
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! |
Fixes #1331