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 the 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 the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.
Description
At present, I do not see a way to add a host rule or path matcher to an existing URL Map. All rules have to be added to a URL Map at creation. However, all backend services aren't always known at the time of creation of a given URL Map and my need to have the rules or matchers updated at a later date in a different repo. The API exists (as seen here: https://cloud.google.com/sdk/gcloud/reference/compute/url-maps/add-host-rule), but I do not see a terraform resource to do it.
Use Case:
I want a module that creates every part of a load balancer (IP, Global Forwarding Rule, Certificate Map, URL Map, etc.) that can then be used to attach backend services to it through other modules. The other modules would take care of the host entry and path matcher portions of the URL Map.
New or Affected Resource(s)
Potential Terraform Configuration
resource "google_compute_url_map" "urlmap" {
name = "urlmap"
description = "a description"
default_service = google_compute_backend_bucket.static.id
}
resource "google_compute_url_map_host_rule" "mysite" {
hosts = ["mysite.com"]
path_matcher = google_compute_url_map_path_matcher.mysite.name
url_map_id = google_compute_url_map.urlmap.id
}
resource "google_compute_url_map_host_rule" "myothersite" {
hosts = ["myothersite.com"]
path_matcher = "otherpaths"
url_map_id = google_compute_url_map.urlmap.id
}
resource "google_compute_url_map_path_matcher" "mysite" {
name = "mysite"
default_service = google_compute_backend_bucket.static.id
path_rule {
paths = ["/home"]
service = google_compute_backend_bucket.static.id
}
path_rule {
paths = ["/login"]
service = google_compute_backend_service.login.id
}
path_rule {
paths = ["/static"]
service = google_compute_backend_bucket.static.id
}
}
}
References
b/376300141
Community Note
Description
At present, I do not see a way to add a host rule or path matcher to an existing URL Map. All rules have to be added to a URL Map at creation. However, all backend services aren't always known at the time of creation of a given URL Map and my need to have the rules or matchers updated at a later date in a different repo. The API exists (as seen here: https://cloud.google.com/sdk/gcloud/reference/compute/url-maps/add-host-rule), but I do not see a terraform resource to do it.
Use Case:
I want a module that creates every part of a load balancer (IP, Global Forwarding Rule, Certificate Map, URL Map, etc.) that can then be used to attach backend services to it through other modules. The other modules would take care of the host entry and path matcher portions of the URL Map.
New or Affected Resource(s)
Potential Terraform Configuration
References
b/376300141