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

Add purpose field to google compute address #2284

Conversation

megan07
Copy link
Contributor

@megan07 megan07 commented Sep 4, 2019

Fixes hashicorp/terraform-provider-google#4167

The API documentation for both address and global address list the same available values for purpose - GCE_ENDPOINT, DNS_RESOLVER, VPC_PEERING and NAT_AUTO. I tried adding these as options here, however, while testing I received the error that DNS_RESOLVER needs to be created by Cloud DNS, NAT_AUTO cannot be created manually, but is automatically created when a NAT is configured, and VPC_PEERING is only available on global addresses. So I went to look at the google_compute_global_address resource, and although the GCP API documentation shows all 4 options there as well, the Terraform resource only allows VPC_PEERING, so I decided to only allow GCE_ENDPOINT on the google_compute_address resource.

If I am correct in my assumption, I think hashicorp/terraform-provider-google#4166 can only be implemented with a global address (purpose VPC_PEERING) and can be closed as well.

Release Note for Downstream PRs (will be copied)

add `purpose` field to `google_compute_address`

@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 9721593.

Pull request statuses

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#1115
depends: GoogleCloudPlatform/terraform-google-conversion#189
depends: hashicorp/terraform-provider-google#4400
depends: modular-magician/ansible#381

@megan07
Copy link
Contributor Author

megan07 commented Sep 4, 2019

As I'm looking over the downstreams, maybe the example isn't necessary for the documentation. Should I create a separate test for this, or is it minor enough that it wouldn't need a specific acceptance test?

@megan07 megan07 requested a review from rileykarson September 4, 2019 18:11
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.

I don't see the harm in adding the test as an example! I find one of our most common user asks is for more examples. + I'd rather we generate the test than not. If we end up with an unwieldy number of examples on resources, we can add a flag to omit certain examples from the docs in the future.

I think your findings about the purpose are correct, and agree with what you think of network on hashicorp/terraform-provider-google#4166.

@@ -0,0 +1,14 @@
// All internal addresses default to a purpose of `GCE_ENDPOINT`, but it is not
// allowed on external addresses, so we can't set the default on the field.
func addressDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
Copy link
Member

Choose a reason for hiding this comment

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

We could implement this as a CustomizeDiff as well I think, setting the new value to the default when address_type is internal. It's little nicer than a DSF imo, because Terraform shows what it will do in plan, but isn't necessary. (this is very much a stretch thing, and feel free to ignore it. Historically we've been a little squeamish about CD, so we don't have great examples of using it so I over-suggest it on PRs sometimes.)

@megan07 megan07 changed the title Megan compute address purpose Add purpose field to google compute address Sep 4, 2019
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 4f6d7d8.

Pull request statuses

terraform-provider-google-beta already has an open PR.
terraform-google-conversion already has an open PR.
terraform-provider-google already has an open PR.
Ansible already has an open PR.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

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.

Add the 'purpose' field to google_compute_address
4 participants