no-environment-conditional
Warn when Terraform chooses behavior from deployment-identity comparisons; prefer explicit typed capabilities or values.
Why
Hard-coded environment branches scatter deployment policy through expressions and obscure the actual capability or value that callers intend to vary.
Fix
Pass the selected typed value or one named capability from the root configuration. Retain an explicit validation, precondition, or check when environment identity is itself the safety invariant.
Examples
locals { tier = var.gcp_project_id == "platform-prod" ? "HA" : "BASIC"}locals { queue = var.project == "analytics" ? "events" : "default"}resource "google_storage_bucket" "cache" { count = var.environment == "sandbox" ? 1 : 0 name = "cache"}resource "google_storage_bucket" "cache" { count = var.enable_object_cache ? 1 : 0 name = "cache"}locals { redis_tier = var.environment == "prod" ? "STANDARD_HA" : "BASIC"}locals { redis_tier = var.redis_tiers_by_environment[var.environment]}module "iam" { source = "./iam" team_platform_owner_privilege = var.environment == "dev" developer_secret_access_v2_enabled = var.environment == "dev"}module "iam" { source = "./iam" team_platform_owner_privilege = var.team_platform_owner_privilege developer_secret_access_v2_enabled = var.developer_secret_access_v2_enabled}