-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 support for default_url_redirect to google_compute_url_map #6081
Add support for default_url_redirect to google_compute_url_map #6081
Comments
@danawillow is this something that modular-magician will be able to take care of? If not I could take a closer look and work on this since I really want to make use of this new feature (I've literally been waiting for this for years). |
Since url_map is a generated resource, the feature addition would have to happen inside of MM, but nothing there actually happens automatically- it's just a different way to describe the API schema for a resource and remove some of the boilerplate that happens when adding features. So if you'd like, you're absolutely welcome to work on this- there's a README/codelab at https://github.com/GoogleCloudPlatform/magic-modules, or depending on your comfort level, you could browse through some merged PRs to see how new fields get added to existing resources. I imagine this one will be fairly straightforward. |
The |
@danawillow I've opened the PR over at GoogleCloudPlatform/magic-modules#3379 I tested it on a fresh Google Cloud project with the following manifest (also committed as an example in the PR) and it does what I expect: provider "google" {
project = "*****"
region = "europe-west1"
}
resource "google_compute_global_forwarding_rule" "default" {
name = "global-rule"
target = google_compute_target_http_proxy.default.self_link
port_range = "80"
}
resource "google_compute_target_http_proxy" "default" {
name = "test-proxy"
url_map = google_compute_url_map.default.self_link
}
resource "google_compute_url_map" "default" {
name = "url-map"
default_url_redirect {
https_redirect = true
}
}
|
Indeed, but it looks like compute API won't let us do this anyway:
Maybe it's not possible to create an url map without any backend service at first, but it is possible to edit one after its creation an to remove this reference (as I did through the console actually). |
@yannlambret oh well, yes: You can't just leave As the API docs state: If So exactly one of these three parameters must be set. As mentioned above my example resource "google_compute_url_map" "default" {
name = "url-map"
default_url_redirect {
https_redirect = true
}
} works well with the terraform provider built from GoogleCloudPlatform/magic-modules#3379! |
Thanks for this clarification (and for the PR) :) |
Sorry to bother but is this already available with terraform 0.12.24 and terraform-google-provider 3.19.0? I tried using it the way it was described here with these versions but I keep getting:
Thanks in advance! |
Got the same issue with versions
Blocks of type "default_url_redirect" are not expected here. |
The feature was added in v3.20.0 (the CHANGELOG is a good place to go to find out what version a feature was released in!) |
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! |
Community Note
Description
Google has added a new
defaultUrlRedirect
feature to URL maps. It's supported both at the top level, and as part of apathMatcher
.New or Affected Resource(s)
google_compute_url_map
Potential Terraform Configuration
This shows creating a
url_map
and associated proxy and forwarding rule for an HTTP -> HTTPS redirect. It would be used in combination with an https proxy that hosted the site(s).References
The text was updated successfully, but these errors were encountered: