Skip to content

Terraform module

The module installs lowtide in your project: network, GKE, Cloud SQL, the segment bucket, IAM, TLS and the Helm release with the agent. Run Terraform yourself explains how to use it. The console renders a main.tf with the required inputs filled in.

The console sets these.

Name Type Description
project_id string Project that holds the cluster, Cloud SQL instance, bucket and service accounts.
region string Region of the cluster, Cloud SQL instance, bucket and internal load balancer, for example europe-west1.
zones list(string) Exactly two different zones in region. A regional persistent disk spans exactly two zones, and each zone runs its own StatefulSet of gateway pods. Can’t change later.
cluster_name string The console’s cluster name as a slug: lower-case letters, digits and hyphens, starting with a letter, at most 24 characters. Prefixes every resource name and is the value of the lowtide-cluster label. Can’t change later.
environment string production or nonProduction. Production always gets a highly available Cloud SQL instance and at least two gateway pods per zone. Non-production allows a zonal instance and one pod per zone.
size string small (up to 20 MiB/s published), medium (up to 100 MiB/s) or large (up to 400 MiB/s). Picks node type and count, WAL disk size and Cloud SQL tier (Sizing).
join_token string, sensitive One-time join token from the console, valid for 24 hours. Only the agent’s first start uses it. It is stored in the Secret lowtide-join-token and in the Terraform state.
Name Type Default Description
gcp_iam_projects list(string) [] Projects whose Pub/Sub names the cluster serves with Cloud IAM authorization. Non-empty turns on gcp-iam and grants the gateway the shadow role in each project. Empty leaves client authentication off; rely on network controls.
endpoint_host string null DNS name clients use, for example pubsub.internal.example.com. Added to the TLS certificate and used in the endpoint output. Null: clients use the internal load balancer’s IP, which is in the certificate too.
lowtide_cloud_url string https://api.lowtide.cloud Control-plane URL the agent connects to, outbound HTTPS only.
licence_public_keys string null The licence verification keys as a JWKS document. The console renders them in. Stored in the ConfigMap lowtide-licence-keys. Null: licences report as invalid, which never affects message traffic.
gcp_iam_snapshot_shadows bool true Include pubsub.snapshots.create and pubsub.subscriptions.consume in the shadow role, for snapshot shadows (Snapshots).
existing_gke_cluster string null Use this GKE cluster instead of creating one: a name in project_id and region, or projects/<p>/locations/<l>/clusters/<name>. It must be Standard, have nodes in both zones and Workload Identity on.
network, subnetwork string null An existing VPC and subnet for a new cluster and Cloud SQL. Set both. Null: create a VPC, or use the existing cluster’s network.
Name Type Default Description
namespace string lowtide Kubernetes namespace of the release, its Secrets and the agent. Can’t change later.
create_namespace bool true Create the namespace. Set false when it exists, for example to put your own TLS Secret in it before the first apply.
labels map(string) {} Extra labels on every labelled GCP resource. app=lowtide and lowtide-cluster=<cluster_name> are always set.
deletion_protection bool true Deletion protection on the GKE cluster and the Cloud SQL instance. Set false and apply before terraform destroy.
enable_apis bool true Enable the APIs the module needs, and Pub/Sub in each gcp_iam_projects project. APIs are never disabled on destroy.
Name Type Default Description
non_production_sql_ha bool false Use a highly available Cloud SQL instance for a non-production cluster too.
node_machine_type string null Gateway node machine type instead of the size’s.
gateways_per_zone number null Gateway pods (and nodes) per zone instead of the size’s. At least 1. Scaling down is not drain-aware (Scale down).
wal_disk_size_gb number null WAL disk size per pod in GiB instead of the size’s. Only growing works later (Grow the disks).
sql_tier string null Cloud SQL machine tier instead of the size’s, for example db-custom-2-8192.
Name Type Default Description
create_node_pool bool true Create the dedicated, tainted gateway node pool. With existing_gke_cluster you can set false to run gateway pods on the cluster’s existing nodes, which you then size yourself.
private_nodes bool true New cluster: nodes get no external IPs. Egress goes through Cloud NAT, which the module creates with the VPC. With your own network, provide NAT or set false.
master_authorized_networks list(object) [] New cluster: {cidr_block, display_name} ranges allowed to reach the Kubernetes API. Empty: any address, still requiring Google IAM credentials. Cloud Shell needs that.
master_ipv4_cidr_block string null New private cluster: a /28 for the control plane’s peering. Null: GKE uses Private Service Connect and needs no range.
release_channel string REGULAR GKE release channel of a new cluster: RAPID, REGULAR or STABLE. Kubernetes 1.31 or later is needed for zone-local routing.
fleet_project string null Register a new cluster in this project’s fleet, so its API is reachable through the Connect gateway (output connect_gateway_host). Usually project_id.
subnet_cidr string 10.64.0.0/20 Created VPC: node subnet range. Also holds the internal load balancer’s IP.
pods_cidr string 10.72.0.0/16 Created VPC: secondary range for pods.
services_cidr string 10.76.0.0/20 Created VPC: secondary range for Services.
pods_range_name, services_range_name string null Your subnet: names of its secondary ranges for pods and Services. Null: GKE creates them.
create_private_service_access bool null Create the Private Service Access range and peering Cloud SQL’s private IP needs. Null: only for a VPC the module creates. An existing network usually has it, and a second connection would replace its ranges.
private_service_access_prefix_length number 20 Size of the Private Service Access range. Cloud SQL needs at least /24.
network_policy bool true Render the chart’s NetworkPolicy: the plaintext port only from gateway pods, TLS and metrics from anywhere. Enforced on a created cluster.
Name Type Default Description
tls_secret_name string null Your own certificate: an existing kubernetes.io/tls Secret in the namespace whose names include endpoint_host. Null: the module issues one from its private CA.
tls_validity_days number 730 Lifetime of the module’s server certificate. The first apply in its last 90 days issues a new one, and the gateway loads it without a restart. The CA lasts 10 years.
endpoint_source_ranges list(string) [] CIDRs allowed to reach the internal load balancer. Empty: the whole VPC.
endpoint_global_access bool false Let clients in other regions of the VPC reach the internal load balancer.
endpoint_zonal_affinity bool true Send clients to gateway pods in their own zone while it has ready pods. Needs GKE 1.33.3-gke.1392000 or later and GKE subsetting. See Cross-zone delivery.
dns_managed_zone string null An existing private Cloud DNS zone in project_id in which to create an A record for endpoint_host. Null: manage DNS yourself.
Name Type Default Description
kms_key string null Customer-managed encryption key, projects/<p>/locations/<region>/keyRings/<r>/cryptoKeys/<k>, in region, for the bucket, Cloud SQL, the WAL disks, node boot disks and GKE Secrets. The module grants the Google service agents use of the key. Changing it later recreates the Cloud SQL instance and the cluster.
Name Type Default Description
manage_gcp_iam_projects bool true Create the shadow role, bind it to the gateway and enable Pub/Sub in each gcp_iam_projects project. Set false when the projects’ owners do that themselves; they then grant the gateway’s service account the role.
gcp_iam_shadow_role string null Grant this existing role in each gcp_iam_projects project, for example an organization-level custom role organizations/<id>/roles/<r>, instead of creating one per project.
pubsub_mirror_projects list(string) [] Projects whose topics lowtide topics are mirrored to during a migration. The gateway gets roles/pubsub.publisher in each. Remove projects once their migration is done.
pubsub_migration_projects list(string) [] Projects whose topics you move from the console. The agent’s service account gets the migration role there (Permissions). Usually the same list as pubsub_mirror_projects. Remove projects once their migration is done.
push_oidc_service_accounts list(string) [] Service accounts that push subscriptions sign OIDC tokens as. The gateway gets Token Creator on each.
never_readable_names bool false The agent always sends topic and subscription names as hashes, whatever the console’s setting. The agent then runs no migration steps (What leaves your project).
Name Type Default Description
max_retention_days number 31 Longest message retention any topic or subscription uses. Pub/Sub’s maximum is 31 days. Sets the bucket’s lifecycle backstop.
retention_margin_days number 7 Added to max_retention_days before the lifecycle rule deletes a segment.
bucket_name string null Segment bucket name, globally unique. Null: <project>-lt-<cluster_name>-<random>.
Name Type Default Description
image_repository string null Gateway and agent image repository. Null: the chart’s default.
image_tag string null Image tag. Null: the chart’s version.
chart, chart_repository, chart_version string null Helm chart source. Null: the chart that comes with the module.
helm_values list(string) [] Extra values YAML documents for the release, applied after the module’s, so they win. Don’t change zones, the release name or the service account here.
cloud_sql_proxy_image string gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.14.1 Cloud SQL Auth Proxy image, a sidecar of every gateway pod and of the database bootstrap Job.
psql_image string postgres:16.6-alpine Image with psql for the one-off database bootstrap Job.
kubectl_image string registry.k8s.io/kubectl:v1.33.5 Image with kubectl for the one-off Job that sets zonal affinity on the load balancer, and for the chart’s hook that rolls upgrades one zone at a time.
Name Description
endpoint Client endpoint (host:443) on the internal load balancer: endpoint_host if set, else the load balancer’s IP. Use it as the client libraries’ API endpoint.
in_cluster_endpoint Endpoint for clients inside the cluster, lowtide.<namespace>.svc:443, with zone-local routing.
endpoint_ip Internal load balancer IP. Point endpoint_host’s DNS record here if the module doesn’t manage it.
tls_ca_certificate PEM of the private CA that signed the gateway’s certificate. Clients trust it (Private CA). Null with tls_secret_name.
gke_cluster GKE cluster ID, projects/<p>/locations/<l>/clusters/<name>.
kubernetes_endpoint, kubernetes_ca_certificate For your kubernetes and helm providers.
connect_gateway_host The Kubernetes API through the Connect gateway, when fleet_project is set. No cluster CA needed.
bucket Segment bucket name.
blob_url Segment store URL the gateway uses (Helm value blob.url).
cloud_sql_instance Cloud SQL connection name, <project>:<region>:<instance>.
gateway_service_account The gateway’s Google service account. Grant it dataset or bucket access for BigQuery or Cloud Storage subscriptions.
agent_service_account The agent’s Google service account, for migration steps.
namespace Kubernetes namespace of the release.
gcp_iam_shadow_roles The shadow role granted in each gcp_iam_projects project.
sizing What size, environment and the overrides resolved to.
Version
Terraform 1.5 or later
hashicorp/google, hashicorp/google-beta ~> 6.12
hashicorp/kubernetes ~> 2.33
hashicorp/helm ~> 2.16 (2.x)
hashicorp/random ~> 3.6
hashicorp/tls 4.0.5 or later, below 5.0