Skip to content
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_compute_network - delete_default_routes_on_create not working #7164

Closed
frankdice opened this issue Aug 31, 2020 · 3 comments · Fixed by GoogleCloudPlatform/magic-modules#3948, #7199 or hashicorp/terraform-provider-google-beta#2460
Assignees
Labels

Comments

@frankdice
Copy link

frankdice commented Aug 31, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the 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 to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v0.13.1 and Terraform v0.12.23

Affected Resource(s)

  • google_compute_network

Terraform Configuration Files

resource "google_compute_network" "vpc_network" {
  name = "vpc-network"
  delete_default_routes_on_create = true
}

Debug Output

2020-08-31T13:59:42.507-0400 [DEBUG] plugin.terraform-provider-google_v3.37.0: 2020/08/31 13:59:42 [DEBUG] Finished creating Network "projects/REDACTED/global/networks/vpc-network": map[string]interface {}{"id":"7525221062018106518", "insertTime":"2020-08-31T10:59:21.228-07:00", "kind":"compute#operation", "name":"operation-1598896760840-5ae3029766245-6265bb77-bc6bbc61", "operationType":"insert", "progress":0, "selfLink":"https://www.googleapis.com/compute/v1/projects/REDACTED/global/operations/operation-1598896760840-5ae3029766245-6265bb77-bc6bbc61", "startTime":"2020-08-31T10:59:21.237-07:00", "status":"RUNNING", "targetId":"5054653421209027734", "targetLink":"https://www.googleapis.com/compute/v1/projects/REDACTED/global/networks/vpc-network", "user":"[email protected]"}
2020-08-31T13:59:42.507-0400 [DEBUG] plugin.terraform-provider-google_v3.37.0: 2020/08/31 13:59:42 [DEBUG] Getting routes for network "vpc-network" with filter '"(network=\"https://compute.googleapis.com/compute/v1/projects/REDACTED/global/networks/vpc-network\") AND (destRange=\"0.0.0.0/0\")"'

Expected Behavior

Default route should be deleted.

gcloud compute routes list --filter '(destRange="0.0.0.0/0")' should return nothing attached to the newly created network

Actual Behavior

The default route is not being deleted.

Steps to Reproduce

  1. terraform apply the snippet above
  2. gcloud compute routes list --filter '(destRange="0.0.0.0/0")' or look at the Routes via the Web UI

Important Factoids

Looks like the problem is pretty straightforward

  • The filter network that we're getting from the upstream google client is incorrect
    • With the bad filter, we're not getting the correct response to find the default route and try to delete it.
    • DEBUG shows this as the base URL for the network we get inside the provider: https://compute.googleapis.com/compute/v1
    • Actual URL in the Google resource via gcloud is https://www.googleapis.com/compute/v1

This can all be re-created with gcloud as well (first is the bad filter, second is the working):
Bad filter
gcloud compute routes list --filter '(network=https://compute.googleapis.com/compute/v1/projects/REDACTED/global/networks/vpc-network) AND (destRange="0.0.0.0/0")'
Good Filter
gcloud compute routes list --filter '(network=https://www.googleapis.com/compute/v1/projects/REDACTED/global/networks/vpc-network) AND (destRange="0.0.0.0/0")'

If this is an upstream issue, stripping the base URL is an option for the filter as well -
gcloud compute routes list --filter '(network=compute/v1/projects/REDACTED/global/networks/vpc-network) AND (destRange="0.0.0.0/0")'

  • #0000
@ghost ghost added the bug label Aug 31, 2020
@venkykuberan venkykuberan self-assigned this Aug 31, 2020
@venkykuberan
Copy link
Contributor

@frankdice looks like the recent code change introduced that bug. I see its working as expected (default routes are being deleted) in the provider version 0.33, please use that version in the mean time while we work on the issue.

@frankdice
Copy link
Author

I can confirm that the 3.33.0 provider version does indeed delete the default route when specified. I'll use that version for now. :)

@ghost
Copy link

ghost commented Oct 5, 2020

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 as resolved and limited conversation to collaborators Oct 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.