Course contentsShow
← Cloud and Infrastructure
Lesson 713 of 2,98913. Infrastructure as Code FoundationsFree lesson

Naming Conventions and Standards

Establish consistent naming patterns for resources, variables, and files to improve readability and maintenance.

Naming Conventions and Standards

What you'll learn: How to create consistent naming patterns for infrastructure resources, variables, and files to make your code readable and maintainable.

Why Naming Matters

When you're managing infrastructure as code across multiple environments, teams, and projects, clear naming conventions act like street signs in a city—they help everyone navigate quickly and avoid getting lost. Without standards, you'll end up with confusing resource names like server1, my-bucket, and prod-db-final-FINAL, making maintenance a nightmare.

Building a Naming Convention

A good naming convention typically includes several components in a predictable order:

Pattern example: {organization}-{environment}-{service}-{resource-type}-{region}

For instance: acme-prod-api-vm-useast1 immediately tells you this is an Acme company production API virtual machine in US East 1.

Key Elements to Include

  • Environment: dev, staging, prod
  • Service/Project: api, frontend, database
  • Resource type: vm, bucket, network
  • Region/Location: useast1, eu-west
  • Sequence number: 01, 02 (when you have multiples)

Variables and Files

Apply similar logic to your code:

  • Variables: environment_name, instance_count, vpc_cidr_block
  • Files: main.tf, variables.tf, prod.tfvars

Use lowercase with underscores or hyphens consistently. Avoid special characters that some cloud providers don't support.

Create a Standards Document

Document your team's conventions in version control alongside your infrastructure code. Include examples and explain the reasoning so new team members can follow the pattern.

Key Takeaway: Consistent, descriptive naming conventions transform infrastructure code from a cryptic puzzle into self-documenting architecture that any team member can understand and maintain confidently.