Skip to content

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

Merged
merged 2 commits into from
Apr 16, 2018

Conversation

rosbo
Copy link
Contributor

@rosbo rosbo commented Apr 13, 2018

  • Use ProjectId when calling the APIs instead of the project name
  • The compute API has to be enabled before we can delete the network
  • The firewall rules inside the default network must be deleted before we delete the network.
  • Update documentation to clarify this side effect.

Fixes #1331

@rosbo
Copy link
Contributor Author

rosbo commented Apr 13, 2018

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'  

@rosbo rosbo changed the title Use projectId and enable required compute API [WIP] Use projectId and enable required compute API Apr 13, 2018
@nat-henderson
Copy link
Contributor

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)
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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!

@rosbo rosbo changed the title [WIP] Use projectId and enable required compute API Fix auto-delete default network in google_project. Apr 14, 2018
@rosbo
Copy link
Contributor Author

rosbo commented Apr 14, 2018

--- PASS: TestAccProject_deleteDefaultNetwork (206.61s)

@ndmckinley tests are passing. PTAL

@rosbo rosbo merged commit 49191c5 into hashicorp:master Apr 16, 2018
@rosbo rosbo deleted the auto-create-network branch April 16, 2018 17:25
chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
* Use projectId and enable required compute API

* Delete firewall rules before deleting default network
@ghost
Copy link

ghost commented Nov 19, 2018

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!

@ghost ghost locked and limited conversation to collaborators Nov 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants