diff --git a/deployment/modules/gcp/loadbalancer/main.tf b/deployment/modules/gcp/loadbalancer/main.tf index 7c9e374..8616a2f 100644 --- a/deployment/modules/gcp/loadbalancer/main.tf +++ b/deployment/modules/gcp/loadbalancer/main.tf @@ -17,7 +17,7 @@ terraform { module "gce-lb-http" { source = "terraform-google-modules/lb-http/google" version = "~> 12.0" - name = "witness-lb-http" + name = "witness-${var.env}-lb-http" project = var.project_id load_balancing_scheme = "EXTERNAL" ssl = true @@ -67,7 +67,7 @@ resource "google_compute_region_network_endpoint_group" "serverless_neg" { for_each = var.witnesses #provider = google-beta - name = "serverless-neg-${each.key}" + name = "serverless-neg-${var.env}-${each.key}" network_endpoint_type = "SERVERLESS" region = each.value.region cloud_run { @@ -77,7 +77,7 @@ resource "google_compute_region_network_endpoint_group" "serverless_neg" { resource "google_compute_url_map" "url_map" { - name = "witness-url-map" + name = "witness-${var.env}-url-map" description = "URL map of witnesses" # Redirect requests to invalid endpoints to the witnesses page on transparency.dev @@ -104,7 +104,7 @@ resource "google_compute_url_map" "url_map" { iterator = each content { - name = "${each.key}-path-matcher" + name = "${var.env}-${each.key}-path-matcher" # Redirect requests to invalid endpoints to the witnesses page on t.dev default_url_redirect { @@ -133,7 +133,7 @@ module "cloud_armor" { count = var.enable_cloud_armor ? 1 : 0 project_id = var.project_id - name = "witness-security-policy" + name = "witness-${var.env}-security-policy" description = "Witness LB Security Policy" default_rule_action = "allow" type = "CLOUD_ARMOR" diff --git a/deployment/modules/gcp/loadbalancer/variables.tf b/deployment/modules/gcp/loadbalancer/variables.tf index 149f55e..f391b99 100644 --- a/deployment/modules/gcp/loadbalancer/variables.tf +++ b/deployment/modules/gcp/loadbalancer/variables.tf @@ -3,6 +3,11 @@ variable "project_id" { type = string } +variable "env" { + description = "Environment name to deploy to" + type = string +} + variable "domain" { description = "Domain mapped to the load balancer." type = string