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 default url redirect to url maps #3379

Merged

Conversation

ctavan
Copy link
Contributor

@ctavan ctavan commented Apr 15, 2020

Fixes hashicorp/terraform-provider-google#6081

A few things that came up while developing this:

Release Note Template for Downstream PRs (will be copied)

compute: Added support for default URL redirects to `google_compute_url_map`
compute: Added support for default URL redirects to `google_compute_region_url_map`

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

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

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

@SirGitsalot, please review this PR or find an appropriate assignee.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 4 files changed, 578 insertions(+), 6 deletions(-))
Terraform Beta: Diff ( 8 files changed, 1162 insertions(+), 11 deletions(-))
Ansible: Diff ( 4 files changed, 950 insertions(+))
TF Conversion: Diff ( 1 file changed, 169 insertions(+))
TF OiCS: Diff ( 8 files changed, 230 insertions(+))
Inspec: Diff ( 7 files changed, 136 insertions(+))

@modular-magician
Copy link
Collaborator

Oops! It looks like you're using an unknown release-note type in your changelog entries:

  • REPLACEME

Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md.

@ctavan
Copy link
Contributor Author

ctavan commented Apr 15, 2020

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@danawillow
Copy link
Contributor

Picking a new reviewer so we get someone who works on TF

@chrisst
Copy link
Contributor

chrisst commented Apr 21, 2020

I'll be able to review this later this week but I'll start by answering some of your questions:

  • re RegionTargetHttpProxies being beta when the feature is GA - we currently move features in the provider to GA only when somebody lets us know. We don't currently have a method to find this out proactively. Would you file a request for this? Or you can send a PR if you would like.
  • writing tests - You can add a hand written test file even though these resources are generated. We frequently will do this for resources so we can test the update method or any special logic. These tests are added in third_party/terraform/tests/*
  • Mutually exclusive logic can be enforced with the exactly_one_of feature or the conflicts feature. At first glance it looks like conflicts is the better option here.

@ctavan
Copy link
Contributor Author

ctavan commented Apr 22, 2020

Re GA, see #3381

I‘ll look into tests and conflicts later today.

@ctavan ctavan force-pushed the add-default-url-redirect-to-url-maps branch from 7f1bea3 to 8fd57a0 Compare April 22, 2020 11:19
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 614 insertions(+), 6 deletions(-))
Terraform Beta: Diff ( 10 files changed, 1252 insertions(+), 21 deletions(-))
Ansible: Diff ( 4 files changed, 1033 insertions(+), 61 deletions(-))
TF Conversion: Diff ( 1 file changed, 169 insertions(+))
TF OiCS: Diff ( 8 files changed, 230 insertions(+))
Inspec: Diff ( 7 files changed, 138 insertions(+), 2 deletions(-))

@modular-magician
Copy link
Collaborator

Oops! It looks like you're using an unknown release-note type in your changelog entries:

  • REPLACEME

Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md.

@ctavan ctavan force-pushed the add-default-url-redirect-to-url-maps branch from 8fd57a0 to c143b8c Compare April 22, 2020 11:25
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 615 insertions(+), 6 deletions(-))
Terraform Beta: Diff ( 10 files changed, 1258 insertions(+), 21 deletions(-))
Ansible: Diff ( 4 files changed, 1033 insertions(+), 61 deletions(-))
TF Conversion: Diff ( 1 file changed, 169 insertions(+))
TF OiCS: Diff ( 8 files changed, 230 insertions(+))
Inspec: Diff ( 7 files changed, 138 insertions(+), 2 deletions(-))

@modular-magician
Copy link
Collaborator

Oops! It looks like you're using an unknown release-note type in your changelog entries:

  • REPLACEME

Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md.

@ctavan ctavan force-pushed the add-default-url-redirect-to-url-maps branch from c143b8c to f7eb76a Compare April 22, 2020 11:38
@ctavan ctavan force-pushed the add-default-url-redirect-to-url-maps branch from f7eb76a to 62d1d71 Compare April 22, 2020 11:41
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 615 insertions(+), 6 deletions(-))
Terraform Beta: Diff ( 10 files changed, 1258 insertions(+), 21 deletions(-))
Ansible: Diff ( 4 files changed, 1033 insertions(+), 61 deletions(-))
TF Conversion: Diff ( 1 file changed, 169 insertions(+))
TF OiCS: Diff ( 8 files changed, 230 insertions(+))
Inspec: Diff ( 7 files changed, 138 insertions(+), 2 deletions(-))

@modular-magician
Copy link
Collaborator

Oops! It looks like you're using an unknown release-note type in your changelog entries:

  • REPLACEME

Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 615 insertions(+), 6 deletions(-))
Terraform Beta: Diff ( 10 files changed, 1258 insertions(+), 21 deletions(-))
Ansible: Diff ( 4 files changed, 1033 insertions(+), 61 deletions(-))
TF Conversion: Diff ( 1 file changed, 169 insertions(+))
TF OiCS: Diff ( 8 files changed, 230 insertions(+))
Inspec: Diff ( 7 files changed, 138 insertions(+), 2 deletions(-))

@modular-magician
Copy link
Collaborator

Oops! It looks like you're using an unknown release-note type in your changelog entries:

  • REPLACEME

Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md.

@ctavan
Copy link
Contributor Author

ctavan commented Apr 22, 2020

@chrisst

  • I've added a basic test that covers the new property. Is it fine to have a separate test case here or should it be added as an additional step in an existing test case?
  • I've added exactly_one_of rules. I think they are more appropriate than conflicts because "exactly one of" seems to be precisely what the API demands. At least I got the following error message when trying to define none of defaultService or defaultUrlRedirect:
    Error: Error updating UrlMap "projects/*/global/urlMaps/url-map": googleapi: Error 400: Invalid value for field 'resource.defaultService': ''. No default backend service specified., invalid
    
    And this error when specifying both:
    Error: Error updating UrlMap "projects/*/global/urlMaps/url-map": googleapi: Error 400: Invalid value for field 'resource.defaultUrlRedirect': '{  "httpsRedirect": true}'. A default redirect can only be specified for a url map if it neither specifies a default service nor a default route action, invalid
    

I think this is ready for review now.

Copy link
Contributor

@chrisst chrisst left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for adding tests as well!

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 629 insertions(+), 6 deletions(-))
Terraform Beta: Diff ( 10 files changed, 1292 insertions(+), 27 deletions(-))
Ansible: Diff ( 4 files changed, 1036 insertions(+), 67 deletions(-))
TF Conversion: Diff ( 1 file changed, 169 insertions(+))
TF OiCS: Diff ( 8 files changed, 230 insertions(+))
Inspec: Diff ( 7 files changed, 150 insertions(+), 2 deletions(-))

@chrisst chrisst merged commit 5cb808a into GoogleCloudPlatform:master Apr 24, 2020
nathkn pushed a commit to nathkn/magic-modules that referenced this pull request May 18, 2020
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 support for default_url_redirect to google_compute_url_map
5 participants