Description
snake_case is a naming convention for Terraform resources, variables and modules.
Potential impact
Inconsistent names make references easier to miss during searches, scripted changes or code review.
Remediation
Use names such as web_server and db_subnet_group. Update references when renaming an existing object. For a managed resource or module, migrate its state address, for example with a moved block, and check the plan for unintended recreation.
Examples
The excerpts omit other properties required to create the cluster.
Before
hcl
resource "aws_eks_cluster" "productionCluster" {
name = "production"
}
After
hcl
resource "aws_eks_cluster" "production_cluster" {
name = "production"
}
The AWS cluster name stays production. Its Terraform label changes from productionCluster to production_cluster.