Remove stage environment from GCP — staging is local only
This commit is contained in:
@@ -35,17 +35,6 @@ resource "google_compute_region_network_endpoint_group" "prod_apac" {
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_compute_region_network_endpoint_group" "stage" {
|
||||
name = "marketing-neg-stage"
|
||||
network_endpoint_type = "SERVERLESS"
|
||||
region = "us-central1"
|
||||
project = var.project_id
|
||||
|
||||
cloud_run {
|
||||
service = google_cloud_run_v2_service.stage.name
|
||||
}
|
||||
}
|
||||
|
||||
# ── Cloud Armor Security Policy ───────────────────────────────────────────────
|
||||
# Applied to the backend service. Rules evaluated top-down (lowest priority wins).
|
||||
|
||||
@@ -173,30 +162,6 @@ resource "google_compute_backend_service" "prod" {
|
||||
}
|
||||
}
|
||||
|
||||
# ── Stage Backend Service ─────────────────────────────────────────────────────
|
||||
|
||||
resource "google_compute_backend_service" "stage" {
|
||||
name = "marketing-backend-stage"
|
||||
project = var.project_id
|
||||
load_balancing_scheme = "EXTERNAL_MANAGED"
|
||||
protocol = "HTTPS"
|
||||
timeout_sec = 30
|
||||
|
||||
# Cloud Armor on stage too
|
||||
security_policy = google_compute_security_policy.marketing.self_link
|
||||
|
||||
enable_cdn = false # CDN off for stage — we want fresh responses always
|
||||
|
||||
backend {
|
||||
group = google_compute_region_network_endpoint_group.stage.self_link
|
||||
}
|
||||
|
||||
log_config {
|
||||
enable = true
|
||||
sample_rate = 1.0
|
||||
}
|
||||
}
|
||||
|
||||
# ── SSL Certificates ──────────────────────────────────────────────────────────
|
||||
# google_compute_managed_ssl_certificate — Google-managed, auto-renewed.
|
||||
# Provisioning requires DNS A records pointing to the LB IP (chicken-and-egg:
|
||||
@@ -214,15 +179,6 @@ resource "google_compute_managed_ssl_certificate" "prod" {
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_compute_managed_ssl_certificate" "stage" {
|
||||
name = "marketing-cert-stage"
|
||||
project = var.project_id
|
||||
|
||||
managed {
|
||||
domains = ["stage.neurontechnologies.ai"]
|
||||
}
|
||||
}
|
||||
|
||||
# ── Prod URL Map — host-based routing ────────────────────────────────────────
|
||||
# One global IP handles all three services via Host header routing.
|
||||
# - neurontechnologies.ai / www. → marketing (default)
|
||||
@@ -324,64 +280,3 @@ resource "google_compute_global_forwarding_rule" "prod_http" {
|
||||
load_balancing_scheme = "EXTERNAL_MANAGED"
|
||||
}
|
||||
|
||||
# ── Stage URL Map ─────────────────────────────────────────────────────────────
|
||||
|
||||
resource "google_compute_url_map" "stage" {
|
||||
name = "marketing-urlmap-stage"
|
||||
project = var.project_id
|
||||
default_service = google_compute_backend_service.stage.self_link
|
||||
}
|
||||
|
||||
# ── Stage HTTPS Target Proxy ──────────────────────────────────────────────────
|
||||
|
||||
resource "google_compute_target_https_proxy" "stage" {
|
||||
name = "marketing-https-proxy-stage"
|
||||
project = var.project_id
|
||||
url_map = google_compute_url_map.stage.self_link
|
||||
ssl_certificates = [google_compute_managed_ssl_certificate.stage.self_link]
|
||||
}
|
||||
|
||||
# ── Stage HTTP → HTTPS redirect ───────────────────────────────────────────────
|
||||
|
||||
resource "google_compute_url_map" "stage_http_redirect" {
|
||||
name = "marketing-urlmap-stage-http-redirect"
|
||||
project = var.project_id
|
||||
|
||||
default_url_redirect {
|
||||
https_redirect = true
|
||||
redirect_response_code = "MOVED_PERMANENTLY_DEFAULT"
|
||||
strip_query = false
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_compute_target_http_proxy" "stage" {
|
||||
name = "marketing-http-proxy-stage"
|
||||
project = var.project_id
|
||||
url_map = google_compute_url_map.stage_http_redirect.self_link
|
||||
}
|
||||
|
||||
# ── Stage Global Forwarding Rules ─────────────────────────────────────────────
|
||||
# Separate global IP for stage so DNS is independent.
|
||||
|
||||
resource "google_compute_global_address" "stage" {
|
||||
name = "marketing-ip-stage"
|
||||
project = var.project_id
|
||||
}
|
||||
|
||||
resource "google_compute_global_forwarding_rule" "stage_https" {
|
||||
name = "marketing-fwd-stage-https"
|
||||
project = var.project_id
|
||||
target = google_compute_target_https_proxy.stage.self_link
|
||||
ip_address = google_compute_global_address.stage.address
|
||||
port_range = "443"
|
||||
load_balancing_scheme = "EXTERNAL_MANAGED"
|
||||
}
|
||||
|
||||
resource "google_compute_global_forwarding_rule" "stage_http" {
|
||||
name = "marketing-fwd-stage-http"
|
||||
project = var.project_id
|
||||
target = google_compute_target_http_proxy.stage.self_link
|
||||
ip_address = google_compute_global_address.stage.address
|
||||
port_range = "80"
|
||||
load_balancing_scheme = "EXTERNAL_MANAGED"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user