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

Terraform: allow deletion of default route upon network creation #1539

Conversation

drebes
Copy link
Member

@drebes drebes commented Mar 18, 2019


[all]

[terraform]

Allow deletion of default route upon network creation

[terraform-beta]

Allow deletion of default route upon network creation

[ansible]

[inspec]

@drebes drebes changed the title Terraform: allow deletion of default route upon creation Terraform: allow deletion of default route upon network creation Mar 18, 2019
@modular-magician
Copy link
Collaborator

Hello! I am a robot who works on Magic Modules PRs.

I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review. They will authorize it to run through our CI pipeline, which will generate downstream PRs.

Thanks for your contribution! A human will be with you soon.

@rileykarson
Copy link
Member

High-level question: Reading through the use case described in the linked issue, what makes this necessary instead of using a google_compute_route to supersede the default route?

If that's a good enough solution for now, ideally, I'd like to solve this in config and file an issue for a parameter on the upstream API instead of solving it in Terraform. I'm not completely opposed- but implementing features like this in Terraform code has a not-insignificant maintenance cost.

@drebes
Copy link
Member Author

drebes commented Mar 20, 2019

The problem with the default route is that it's not created through the API, but automatically created at network creation time. So a google_compute_route cannot be used to delete it (unless I'm missing something). Not having a default route is a requirement for many enterprise customers (which either want the default route to go to on-prem or to a peered VPC.

@rileykarson
Copy link
Member

Right! I'm thinking that this is done by the user, by adding a route whose priority means it'll always be taken over the default route; especially in modules, users can easily accomplish this.

If you're certain that's not acceptable for those users, I'm 👍 on adding the feature, but if it's a universally useful feature, I'd like to try and bring up upstreaming the feature with the product team as well.

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

Made a first pass, unfortunately Terraform isn't great at new fields with defaults so we'll need to coerce it a little.

products/compute/terraform.yaml Outdated Show resolved Hide resolved
@drebes drebes force-pushed the terraform-delete-default-route branch from 818fdda to adec6a4 Compare April 5, 2019 20:09
@drebes drebes requested a review from rileykarson April 5, 2019 20:15
Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

Mostly, yep! We'll never see the field on the resource object so we'll need to pull it from state instead. This suggestion should work if you don't mind verifying.

templates/terraform/decoders/network.erb Outdated Show resolved Hide resolved
templates/terraform/decoders/network.erb Outdated Show resolved Hide resolved
@drebes drebes force-pushed the terraform-delete-default-route branch from adec6a4 to 6c7069a Compare April 5, 2019 20:50
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
This PR seems not to have generated downstream PRs before, as of 6c7069a.

Pull request statuses

No diff detected in terraform-google-conversion.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google-beta#592
depends: hashicorp/terraform-provider-google#3391

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

Thanks! Looks great.

Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec.
@modular-magician modular-magician merged commit 00c3517 into GoogleCloudPlatform:master Apr 5, 2019
@drebes drebes deleted the terraform-delete-default-route branch March 13, 2020 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants