From a92980cba7d81ed3fae323fcd764b9a21fb77be5 Mon Sep 17 00:00:00 2001 From: Mohit Shukla Date: Tue, 30 Apr 2024 21:25:20 +0530 Subject: [PATCH] feat: Enable user to enable mirroring collector capability. (#135) --- README.md | 1 + main.tf | 29 +++++++++++++++-------------- variables.tf | 7 +++++++ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 7ec7ef8..6bb8133 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ module "gce-ilb" { | health\_check | Health check to determine whether instances are responsive and able to do work |
object({
type = string
check_interval_sec = number
healthy_threshold = number
timeout_sec = number
unhealthy_threshold = number
response = string
proxy_header = string
port = number
port_name = string
request = string
request_path = string
host = string
enable_log = bool
})
| n/a | yes | | ip\_address | IP address of the internal load balancer, if empty one will be assigned. Default is empty. | `string` | `null` | no | | ip\_protocol | The IP protocol for the backend and frontend forwarding rule. TCP or UDP. | `string` | `"TCP"` | no | +| is\_mirroring\_collector | Indicates whether or not this load balancer can be used as a collector for packet mirroring. This can only be set to true for load balancers that have their loadBalancingScheme set to INTERNAL. | `bool` | `false` | no | | labels | The labels to attach to resources created by this module. | `map(string)` | `{}` | no | | name | Name for the forwarding rule and prefix for supporting resources. | `string` | n/a | yes | | network | Name of the network to create resources in. | `string` | `"default"` | no | diff --git a/main.tf b/main.tf index be4973e..60272a6 100644 --- a/main.tf +++ b/main.tf @@ -28,20 +28,21 @@ data "google_compute_subnetwork" "network" { } resource "google_compute_forwarding_rule" "default" { - project = var.project - name = var.name - region = var.region - network = data.google_compute_network.network.self_link - subnetwork = data.google_compute_subnetwork.network.self_link - allow_global_access = var.global_access - load_balancing_scheme = "INTERNAL" - backend_service = google_compute_region_backend_service.default.self_link - ip_address = var.ip_address - ip_protocol = var.ip_protocol - ports = var.ports - all_ports = var.all_ports - service_label = var.service_label - labels = var.labels + project = var.project + name = var.name + region = var.region + network = data.google_compute_network.network.self_link + subnetwork = data.google_compute_subnetwork.network.self_link + allow_global_access = var.global_access + load_balancing_scheme = "INTERNAL" + is_mirroring_collector = var.is_mirroring_collector + backend_service = google_compute_region_backend_service.default.self_link + ip_address = var.ip_address + ip_protocol = var.ip_protocol + ports = var.ports + all_ports = var.all_ports + service_label = var.service_label + labels = var.labels } resource "google_compute_region_backend_service" "default" { diff --git a/variables.tf b/variables.tf index 4fc7d50..f4b1b9b 100644 --- a/variables.tf +++ b/variables.tf @@ -171,3 +171,10 @@ variable "labels" { default = {} type = map(string) } + +variable "is_mirroring_collector" { + description = "Indicates whether or not this load balancer can be used as a collector for packet mirroring. This can only be set to true for load balancers that have their loadBalancingScheme set to INTERNAL." + default = false + type = bool +} +