Skip to content
Merged
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
14 changes: 13 additions & 1 deletion deploy/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,23 @@ resource "google_compute_backend_service" "roach" {
}
}

# A new domain needs a new certificate. The proxy uses the old one until
# the new one exists, so each certificate gets its own name.
resource "random_id" "certificate" {
byte_length = 4
keepers = {
domain = var.domain
}
}

resource "google_compute_managed_ssl_certificate" "roach" {
name = "roach"
name = "roach-${random_id.certificate.hex}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certificate replaced without domain change

High Severity

A new random_id is interpolated into the certificate name, so the next apply replaces the live roach certificate even when var.domain is unchanged. Terraform then points the SSL proxy at the still-PROVISIONING cert and deletes the active one, taking HTTPS down until Google finishes issuing it.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c2e5056. Configure here.

managed {
domains = [var.domain]
}
lifecycle {
create_before_destroy = true
}
}

resource "google_compute_target_ssl_proxy" "roach" {
Expand Down
Loading