Skip to content

OpenTofu Variables

Values are resolved in this order, lowest to highest:

  1. Variable defaults (declared in variables.tf)
  2. shared.tfvars (passed via -var-file=../shared.tfvars)
  3. Provider-specific terraform.tfvars
  4. -var flags on the command line
  5. TF_VAR_ environment variables

tofu/remote/shared.tfvars holds values that apply to all providers. Both DigitalOcean and GKE declare these variables so neither produces an “undeclared variable” error when OpenTofu loads the shared file.

VariableTypeValueNotes
cluster_namestring"ccafp"Kubernetes cluster name
registry_namestring"rs-inc"Container registry name. Used by DigitalOcean; declared but unused by GKE (see below).

Defined in tofu/remote/digitalocean/variables.tf.

VariableTypeDefaultDescription
cluster_namestringKubernetes cluster name. Required; supplied by shared.tfvars.
regionstring"syd1"DigitalOcean region slug.
node_sizestring"s-1vcpu-2gb"Droplet size slug for worker nodes.
node_countnumber3Initial number of worker nodes.
VariableTypeDefaultDescription
auto_scalebooltrueEnable cluster autoscaling.
min_nodesnumber2Minimum nodes when autoscaling.
max_nodesnumber4Maximum nodes when autoscaling.
VariableTypeDefaultDescription
registry_namestring"rs-inc"DigitalOcean container registry name. Overridden by shared.tfvars.
VariableTypeDefaultDescription
maintenance_daystring"sunday"Day of week for the maintenance window.
maintenance_start_timestring"04:00"Start time (UTC) for the maintenance window.

Defined in tofu/remote/google/variables.tf.

VariableTypeDefaultDescription
project_idstringnullGCP project ID. Set via TF_VAR_project_id, GOOGLE_PROJECT, or terraform.tfvars.
cluster_namestringGKE cluster name. Required; supplied by shared.tfvars.
regionstring"australia-southeast1"GCP region.
zonestring"australia-southeast1-a"GCP zone. Zonal clusters get a free control plane under the GKE free tier.
deletion_protectionbooltruePrevent accidental cluster deletion. The CLI destroy command accepts --i-am-sure to override.
VariableTypeDefaultDescription
machine_typestring"e2-medium"Node machine type.
node_countnumber3Nodes per zone.
spotbooltrueUse Spot VMs for worker nodes. Reduces cost; nodes may be preempted.
disk_size_gbnumber30Boot disk size per node in GB.
VariableTypeDefaultDescription
auto_scalebooltrueEnable node pool autoscaling.
min_nodesnumber1Minimum nodes when autoscaling.
max_nodesnumber4Maximum nodes when autoscaling.
VariableTypeDefaultDescription
network_namestring""VPC network name. Empty string uses the default network.
subnet_cidrstring"10.10.0.0/24"Primary subnet CIDR range.
pod_cidrstring"10.20.0.0/16"Secondary IP range for pods.
service_cidrstring"10.30.0.0/20"Secondary IP range for services.
VariableTypeDefaultDescription
artifact_registry_idstring""Artifact Registry repository ID. GKE uses this instead of registry_name.
registry_namestring""Unused by GKE. Declared for shared.tfvars compatibility so OpenTofu does not raise an undeclared variable error.