terraform-google-lb-http icon indicating copy to clipboard operation
terraform-google-lb-http copied to clipboard

feat: add support for host and path rules in URL map

Open bwmacedo opened this issue 1 year ago • 4 comments

Issue #466 This PR introduces support for host and path rules within the terraform-google-lb-http module, enhancing its flexibility for routing configurations. It adds two new variables, host_rules and path_matchers, to allow users to define custom host-based and path-based routing rules in URL maps. This change enables more granular control over HTTP(S) load balancing behavior, particularly for use cases involving Serverless NEGs (e.g., Cloud Run, App Engine).

Changes:

New Variables:

  • host_rules: Defines host rules, associating specified hosts with a path matcher.
  • path_matchers: Allows detailed path matching configurations, including path rules and default services.

URL Map Resource Update:

  • Updated the google_compute_url_map resource to support dynamic host_rule and path_matcher blocks based on the new variables. This enhancement provides modular and flexible routing options for complex load balancer setups.

Example Configuration:

host_rules = [
  {
    hosts        = ["example.com"]
    path_matcher = "example-path-matcher"
  }
]

path_matchers = [
  {
    name            = "example-path-matcher"
    default_service = google_compute_backend_service.default.self_link
    path_rules = [
      {
        paths   = ["/path1", "/path2"]
        service = google_compute_backend_service.other_service.self_link
      }
    ]
  }
]

Motivation: This enhancement reduces the need for module customization, making it easier to configure complex load balancing scenarios directly within the module. This is especially beneficial for users with requirements for specific host and path routing logic.

Additional Information: Documentation updates and additional examples are included to illustrate usage scenarios.

bwmacedo avatar Nov 08 '24 15:11 bwmacedo

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

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Nov 08 '24 15:11 google-cla[bot]

When can we expect any progress with this PR? It would be awesome to have such possibility!

karolcienkosz avatar Jan 02 '25 21:01 karolcienkosz

Any update on reviewing this PR? It is a very useful feature.

smallwat3r avatar Mar 28 '25 11:03 smallwat3r

Hello, what can we do to push this topic further?

karolcienkosz avatar May 18 '25 09:05 karolcienkosz

@bwmacedo thx for the PR. Can you plz follow contribution guide to generate the code?

https://github.com/terraform-google-modules/terraform-google-lb-http/blob/main/CONTRIBUTING.md

imrannayer avatar Jul 14 '25 15:07 imrannayer