Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ locals {
env = "staging"
project_id = get_env("GOOGLE_PROJECT", "static-ct-staging")
location = get_env("GOOGLE_REGION", "us-central1")
log_location = get_env("GOOGLE_REGION", "us-central1")
log_names = ["arche2025h1", "arche2025h2", "arche2026h1"]
submission_host_suffix = ".staging.ct.transparency.dev"
enable_cloud_armor = true
logs = {
"arche2025h1" = "us-central1"
"arche2025h2" = "us-central1"
"arche2026h1" = "us-central1"
}
}

inputs = local
Expand Down
24 changes: 12 additions & 12 deletions deployment/modules/gcp/loadbalancer/external/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module "gce-lb-http" {
ssl = true
// Create one cert per log, wildcard certificates are not supported.
// Put staging.ct.transparency.dev first for it be used as the Common Name.
managed_ssl_certificate_domains = concat(["staging.ct.transparency.dev"], [for log_name in var.log_names : "${log_name}.staging.ct.transparency.dev"])
managed_ssl_certificate_domains = concat(["staging.ct.transparency.dev"], [for log_name, _ in var.logs: "${log_name}.staging.ct.transparency.dev"])
random_certificate_suffix = true

// Firewalls are defined externally.
Expand All @@ -30,8 +30,8 @@ module "gce-lb-http" {
// Use the Cloud Armor policy, if it's enabled.
security_policy = one(module.cloud_armor[*].policy.self_link)

backends = { for log_name in var.log_names :
"${log_name}-backend" => {
backends = { for name, region in var.logs:
"${name}-backend" => {
protocol = "HTTP"
port = 80
port_name = "http"
Expand All @@ -55,7 +55,7 @@ module "gce-lb-http" {
groups = [
{
// A Backend group must have beed deployed independently at this URI.
group = "projects/${var.project_id}/regions/${var.log_location}/instanceGroups/${log_name}-instance-group-manager"
group = "projects/${var.project_id}/regions/${region}/instanceGroups/${name}-instance-group-manager"
balancing_mode = "RATE"
// Based on the most recent load tests /docs/performance.md
// Caution:
Expand Down Expand Up @@ -86,20 +86,20 @@ resource "google_compute_url_map" "url_map" {
}

dynamic "host_rule" {
for_each = var.log_names
iterator = log_name
for_each = var.logs
iterator = log
content {
hosts = ["${log_name.value}${var.submission_host_suffix}"]
path_matcher = "${log_name.value}-path-matcher"
hosts = ["${log.key}${var.submission_host_suffix}"]
path_matcher = "${log.key}-path-matcher"
}
}

dynamic "path_matcher" {
for_each = var.log_names
iterator = log_name
for_each = var.logs
iterator = log

content {
name = "${log_name.value}-path-matcher"
name = "${log.key}-path-matcher"

// TODO(phboneff): point at json once we have it
default_url_redirect {
Expand All @@ -116,7 +116,7 @@ resource "google_compute_url_map" "url_map" {
"/ct/v1/add-chain",
"/ct/v1/get-roots",
]
service = module.gce-lb-http.backend_services["${log_name.value}-backend"].self_link
service = module.gce-lb-http.backend_services["${log.key}-backend"].self_link
}
}
}
Expand Down
11 changes: 3 additions & 8 deletions deployment/modules/gcp/loadbalancer/external/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ variable "project_id" {
type = string
}

variable "log_names" {
description = "Name of logs wired to the load balancer."
type = list(string)
variable "logs" {
description = "Map of log names to regions."
type = map(string)
}

variable "submission_host_suffix" {
description = "Submission host suffix, appended to each log name."
type = string
}

variable "log_location" {
description = "Location in which log resources are."
type = string
}

variable "enable_cloud_armor" {
description = "Whether or not to enable Cloud Armor for the load balancer."
type = bool
Expand Down
Loading