Skip to content
Sarj Code Standards

no-hardcoded-deployment-location

Pass cloud deployment identities, locations and network values through explicit configuration inputs.

Why

Literal deployment identities and coordinates inside infrastructure implementations bypass the caller's configuration. Changing inputs can leave resources bound to an old project, location, address or domain.

Fix

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

Examples

Before — flagged The resource ignores caller placement configuration
main.tf
resource "google_storage_bucket" "this" {
project = "example-project"
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
}