GoogleCloudPlatform/cloud-foundation-fabric

Feature Request: Support for Multiple Forwarding Rules in net-lb-app-int Module

Closed this issue · 1 comments

Feature Request

I am using the net-lb-app-int module from the Cloud Foundation Fabric repository to configure an internal load balancer for my GCP setup. I need to configure multiple forwarding rules (one for HTTP and one for HTTPS), but the module currently does not support defining multiple forwarding rules for the same load balancer.

The current limitation can be seen in the net-lb-app-int module. However, as shown in the attached screenshot from my GCP environment, I need to configure two different frontend rules: one for HTTP (port 80) and one for HTTPS (port 443). The module should be able to handle this use case.

Current Situation:

  • Only one forwarding rule can be configured at a time.
  • Need to configure two forwarding rules (HTTP and HTTPS) for the same load balancer.

Proposed Solution:

  • Extend the net-lb-app-int module to support multiple forwarding rules (e.g., adding a list input for forwarding_rules to allow for multiple protocol and port combinations).
  • Example:
    forwarding_rules = [
      {
        protocol = "HTTP"
        port     = 80
      },
      {
        protocol = "HTTPS"
        port     = 443
      }
    ]
    
    

Example manual configuration:
Screenshot 2024-09-11 112515

using resources:

resource "google_compute_forwarding_rule" "INTERNAL_FWD_RULE_HTTP" {
  name                  = "frontend-80"
  depends_on            = [google_compute_subnetwork.proxy_subnet]
  ip_protocol = "TCP"
  load_balancing_scheme = "INTERNAL_MANAGED"
  target                = google_compute_region_target_http_proxy.default.self_link
  ip_address            = google_compute_address.internal_with_subnet_and_address.address
  network               = google_compute_network.default.id
  subnetwork            = google_compute_subnetwork.default.id
  port_range            = "80"
}
resource "google_compute_forwarding_rule" "INTERNAL_FWD_RULE_HTTPS" {
  name                  = "frontend-443"
  depends_on            = [google_compute_subnetwork.proxy_subnet]
  ip_protocol = "TCP"
  load_balancing_scheme = "INTERNAL_MANAGED"
  target                = google_compute_region_target_https_proxy.default.self_link
  ip_address            = google_compute_address.internal_with_subnet_and_address.address
  network               = google_compute_network.default.id
  subnetwork            = google_compute_subnetwork.default.id
  port_range            = "443"
ludoo commented

You should use an additional load balancer, as shown in this external app LB example.