Case 04 (interactive) - A scripted answer may name who it is for, so facts written for requirements discovery are not given to a Specialist confirming a draft. - A reply that restates what the agreed requirements already say is read as an answer, not a request for changes. - With a user present, a first submission is refused until the user has been shown a draft of that Deliverable (CONFIRM_DRAFTS). Routing and reviews - Intake: a message that starts something is read first. A question is answered and starts nothing; a change to delivered work starts as a new request with a note, until Change requests are built. - Requirements and recommendations list what infrastructure code can show (conditions) apart from what it cannot (outside_code); the latter needs no Check and validation proposes nothing for it. - A requirements review, "names no products", behind its own switch (off). - Each pillar advisor reviews its pillar's checklist; the engine writes the reviews into the design recommendations. The judged checklist check went from 9-45% a pillar to 100% in one run of case 04. Evaluation - Per-case thresholds for Revisions, seconds and tokens, set from every completed run on this build. - A progress file after every agent run, so an interrupted run keeps its time and tokens. - eval/calibrate_judge.py with a 32-question set awaiting a person's labels. Unlabelled: Jev stable at 1.00, Gemini 0.92, agreeing on 0.91. Smaller - An Execution that ends with warnings writes its Deliverables, with the warnings and each status in the manifest. - CI installs the application's dependencies before linting and testing. - A load-balancer pattern in the IaC patterns Skill. Plans record nine runs of 2026-10-08. Iteration 6 is complete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5.6 KiB
5.6 KiB
External Application Load Balancer
A global HTTPS load balancer in front of a Cloud Run service, with a TLS policy, a web application firewall policy and, optionally, Identity-Aware Proxy.
The chain is: forwarding rule → target HTTPS proxy → URL map → backend service → serverless network endpoint group → Cloud Run service. Each setting lives on one link of it, and putting one on the wrong link is the usual mistake:
- The minimum TLS version is on an SSL policy, attached to the target HTTPS proxy (
ssl_policy). A backend service has nossl_policysetting. - The certificate is on the target HTTPS proxy (
ssl_certificates). - The firewall policy is attached to the backend service (
security_policy). - Identity-Aware Proxy is the
iapblock of the backend service. It decides who reaches the application; what a signed-in user may do inside it is the application's own code and cannot be shown by infrastructure. - Request logging is the
log_configblock of the backend service. - A backend service for Cloud Run uses a serverless NEG and takes no
health_checks, noport_nameand notimeout_sec. load_balancing_scheme = "EXTERNAL_MANAGED"on both the backend service and the forwarding rule.- Set the Cloud Run service's
ingresstoINGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER, or it stays reachable around the load balancer. - Redirecting HTTP to HTTPS needs a second URL map, target HTTP proxy and forwarding rule on port 80.
variable "project_id" {
type = string
description = "Project to deploy into."
}
variable "region" {
type = string
description = "Region for regional resources."
}
variable "domain" {
type = string
description = "Domain name the load balancer serves."
}
resource "google_cloud_run_v2_service" "app" {
project = var.project_id
name = "booking-app"
location = var.region
ingress = "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"
template {
containers {
image = "us-docker.pkg.dev/cloudrun/container/hello"
}
}
}
resource "google_compute_region_network_endpoint_group" "app" {
project = var.project_id
name = "booking-app"
region = var.region
network_endpoint_type = "SERVERLESS"
cloud_run {
service = google_cloud_run_v2_service.app.name
}
}
resource "google_compute_security_policy" "edge" {
project = var.project_id
name = "booking-edge"
rule {
action = "deny(403)"
priority = 1000
match {
expr {
expression = "evaluatePreconfiguredWaf('sqli-v33-stable', {'sensitivity': 1})"
}
}
description = "Block SQL injection."
}
rule {
action = "allow"
priority = 2147483647
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = ["*"]
}
}
description = "Default rule."
}
}
resource "google_compute_backend_service" "app" {
project = var.project_id
name = "booking-app"
protocol = "HTTPS"
load_balancing_scheme = "EXTERNAL_MANAGED"
security_policy = google_compute_security_policy.edge.id
backend {
group = google_compute_region_network_endpoint_group.app.id
}
# Only signed-in identities granted roles/iap.httpsResourceAccessor get through.
iap {
enabled = true
}
log_config {
enable = true
sample_rate = 1.0
}
}
resource "google_compute_url_map" "app" {
project = var.project_id
name = "booking-app"
default_service = google_compute_backend_service.app.id
}
resource "google_compute_ssl_policy" "modern" {
project = var.project_id
name = "tls-1-2-modern"
profile = "MODERN"
min_tls_version = "TLS_1_2"
}
resource "google_compute_managed_ssl_certificate" "app" {
project = var.project_id
name = "booking-app"
managed {
domains = [var.domain]
}
}
resource "google_compute_target_https_proxy" "app" {
project = var.project_id
name = "booking-app"
url_map = google_compute_url_map.app.id
ssl_certificates = [google_compute_managed_ssl_certificate.app.id]
ssl_policy = google_compute_ssl_policy.modern.id
}
resource "google_compute_global_address" "app" {
project = var.project_id
name = "booking-app"
}
resource "google_compute_global_forwarding_rule" "https" {
project = var.project_id
name = "booking-app-https"
load_balancing_scheme = "EXTERNAL_MANAGED"
ip_address = google_compute_global_address.app.id
port_range = "443"
target = google_compute_target_https_proxy.app.id
}
# HTTP to HTTPS.
resource "google_compute_url_map" "redirect" {
project = var.project_id
name = "booking-app-redirect"
default_url_redirect {
https_redirect = true
strip_query = false
}
}
resource "google_compute_target_http_proxy" "redirect" {
project = var.project_id
name = "booking-app-redirect"
url_map = google_compute_url_map.redirect.id
}
resource "google_compute_global_forwarding_rule" "http" {
project = var.project_id
name = "booking-app-http"
load_balancing_scheme = "EXTERNAL_MANAGED"
ip_address = google_compute_global_address.app.id
port_range = "80"
target = google_compute_target_http_proxy.redirect.id
}
# Who may pass Identity-Aware Proxy.
resource "google_iap_web_backend_service_iam_member" "staff" {
project = var.project_id
web_backend_service = google_compute_backend_service.app.name
role = "roles/iap.httpsResourceAccessor"
member = "domain:${var.domain}"
}