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

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bwmacedo
Copy link

@bwmacedo bwmacedo commented Nov 8, 2024

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 bwmacedo requested review from imrannayer, q2w and a team as code owners November 8, 2024 15:00
Copy link

google-cla bot commented Nov 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant