Awesome Reviewers

Reviewer · Configurations

Centralize configuration values

Avoid hardcoding environment-specific values (ports, versions, CIDRs, credentials, etc.) directly inside modules or scattering the same literal across multiple files. Instead, define these values once as globals (e.g., in enos-globals.hcl) or as module variables with sensible defaults, and have callers reference or override them consistently. This prevents...

Instruction

Avoid hardcoding environment-specific values (ports, versions, CIDRs, credentials, etc.) directly inside modules or scattering the same literal across multiple files. Instead, define these values once as globals (e.g., in enos-globals.hcl) or as module variables with sensible defaults, and have callers reference or override them consistently. This prevents drift when a value changes, makes the single source of truth obvious, and allows values to be surfaced as state/output when needed for downstream consumption.

For example, instead of:

locals {
  ldap_server = {
    port  = "389"
    sport = "636"
  }
}

prefer:

variable "ldap_port" {
  type        = string
  default     = global.ports.ldap
}

variable "ldaps_port" {
  type        = string
  default     = global.ports.ldaps
}

and reference global.ports/global.ldap_version wherever the value is needed, rather than repeating the literal. Similarly, avoid setting defaults for values that must be derived/passed from another module (e.g., ipv6_cidr should come from create_vpc, not have a hardcoded default), and ensure configuration-bearing variables (like a host) are structured as objects carrying all necessary connection details (public/private IPv4/IPv6) rather than a single flat string, so downstream modules aren’t forced to guess or duplicate logic.