A hierarchical naming system builds each component name by extending its parent name with identifiers for nested components. In Terraform, module depth appears in resource addresses, command output, and state, making the naming structure visible operationally. section 10.1.2
Naming an Acme application
Set a stable application name and combine it with the environment: acme-production. Pass distinct extensions to child modules, such as acme-production-api and acme-production-db. Inside the service module, continue the hierarchy with names such as -lb, -logs, -cluster, and -service.
Use unique suffixes for each module and resource to prevent naming conflicts. When a provider imposes additional constraints, append a generated suffix; the example uses a six-character, lowercase, non-special random string for a secret.
