Files
solution_architecture_agent/skills/google-cloud-iac-modules/references/network.md
Jonathan Boniface c84dbdea20 feat: the solution architecture agent on the shared Execution engine
The reference agent's subject, cloud solution architecture, as an agent in
the operating model agent's pattern: the Execution engine (from
orchestration_engine) and one Workflow in app/solution_architecture,
built for the settings and provider bundle by assembly.workflow_for.

Copied from gcp_solution_architecture_agent at 8b397cd without its own
engine: its role files, Skills, provider bundle, ADRs, vocabulary, scripts
and evaluation datasets. The image takes the engine from a named build
context and installs Terraform. It is called through the Orchestration
engine, and its files are what the operating model agent digests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 19:49:28 +01:00

1.9 KiB

VPC network and Cloud NAT

A custom-mode VPC with its subnets and firewall rules, and outbound internet through Cloud NAT. Replaces a network, its subnetworks, a router, a NAT and each firewall rule.

  • subnets is a list of objects whose values are all strings, including "true" for subnet_private_access.
  • network_name is a name. Other resources want module.network.network_self_link or network_id; subnets is an output map keyed "<region>/<subnet_name>".
  • ingress_rules replaces the deprecated firewall_rules.
  • The NAT module creates its router when create_router = true, and then needs network.
  • Set name on the NAT. Left unset it gets a random suffix.
variable "project_id" {
  type        = string
  description = "Project to deploy into."
}

variable "region" {
  type        = string
  description = "Region for regional resources."
}

module "network" {
  source  = "terraform-google-modules/network/google"
  version = "18.3.1"

  project_id   = var.project_id
  network_name = "workload"
  routing_mode = "REGIONAL"

  subnets = [
    {
      subnet_name           = "workload"
      subnet_ip             = "10.10.0.0/24"
      subnet_region         = var.region
      subnet_private_access = "true"
      subnet_flow_logs      = "true"
    }
  ]

  ingress_rules = [
    {
      name          = "allow-health-checks"
      source_ranges = ["130.211.0.0/22", "35.191.0.0/16"]
      allow = [
        {
          protocol = "tcp"
          ports    = ["8080"]
        }
      ]
    }
  ]
}

module "nat" {
  source  = "terraform-google-modules/cloud-nat/google"
  version = "7.1.0"

  project_id    = var.project_id
  region        = var.region
  name          = "workload-nat"
  create_router = true
  router        = "workload-router"
  network       = module.network.network_self_link

  log_config_enable = true
  log_config_filter = "ERRORS_ONLY"
}