Skip to content
Sarj Code Standards

no-hardcoded-deployment-location

Pass cloud deployment regions, zones and locations through explicit configuration inputs.

Why

Literal placement coordinates inside infrastructure implementations bypass the caller's deployment configuration. Resources in one module can silently remain in different locations when inputs change.

Fix

Reuse an existing typed region, zone or location input; otherwise add the smallest required input. Define deployment policy in caller inputs, variable defaults or tfvars instead of scattering literal coordinates and matching preconditions through resource implementations.

Examples

Before — flagged The resource ignores caller placement configuration
main.tf
resource "google_storage_bucket" "this" {
location = "us-central1"
}
After — preferred The caller owns placement through a typed input
main.tf
variable "region" { type = string }
resource "google_storage_bucket" "this" {
location = var.region
}