terraform-style-guide

Provide AVM-aware Terraform style guidance for infrastructure code.

Updated Dec 4, 2025
One-click install
npx skills add https://github.com/CloudbrokerAz/ai-iac-consumer --skill terraform-style-guide-cloudbrokeraz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-style-guide
Source: https://github.com/CloudbrokerAz/ai-iac-consumer/tree/main/.claude/skills/terraform-style-guide
Command: npx skills add https://github.com/CloudbrokerAz/ai-iac-consumer --skill terraform-style-guide-cloudbrokeraz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive style guide for Terraform code, ensuring consistency, readability, and maintainability across projects. It helps teams establish and enforce coding standards, reducing technical debt and improving collaboration by providing clear guidelines for formatting, naming, and organization.

Core Features & Use Cases

  • Code Formatting: Guidelines for indentation, alignment, and block organization, with automation via terraform fmt.
  • Naming Conventions: Best practices for naming resources, variables, and outputs using descriptive, lowercase, snake_cased names.
  • File & Resource Organization: Standardized file structure and logical ordering of resources based on dependencies for improved clarity.
  • AVM & AWS Specifics: Includes mandatory requirements for Azure Verified Modules and AWS resource tagging/naming conventions.
  • Use Case: Onboard a new team member to Terraform development by providing a single source of truth for all coding standards, from file structure to variable declarations and cloud-specific best practices.

Quick Start

Explain the recommended file organization for a new Terraform project, including the purpose of terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf, and locals.tf.

Frequently Asked Questions about terraform-style-guide

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize Terraform code across my team?

Standardize Terraform code by establishing naming conventions, file organization, and formatting rules. Use `terraform fmt` for automation, enforce descriptive lowercase snake_case names for resources and variables, and organize files into `terraform.tf`, `providers.tf`, `main.tf`, `variables.tf`, `outputs.tf`, and `locals.tf` for consistency and maintainability across multi-environment projects.

What file structure should I use for Terraform projects?

Organize Terraform projects with dedicated files: `terraform.tf` for version constraints, `providers.tf` for provider configuration, `main.tf` for resources, `variables.tf` for input declarations, `outputs.tf` for exposed values, and `locals.tf` for local values. This structure improves readability and aligns with HashiCorp and Azure Verified Module conventions.

How do I ensure my Terraform code meets Azure Verified Module standards?

Enforce AVM compliance by implementing cross-referencing, provider version constraints, descriptive variable and output metadata, consistent naming conventions, and prescribed file organization. Follow Azure Verified Module and HashiCorp style conventions to ensure infrastructure code is deployable, auditable, and maintainable across Azure environments.

What naming conventions should I use for Terraform resources and variables?

Use descriptive, lowercase, snake_cased names for all resources, variables, and outputs. This convention improves code clarity, reduces ambiguity during reviews, and ensures consistency across teams. Descriptive naming also supports better cross-referencing and makes infrastructure intent immediately clear to collaborators.

Can I automate Terraform code formatting to enforce style guidelines?

Yes, `terraform fmt` automatically enforces formatting standards including indentation and block organization. Combined with explicit naming and file structure guidelines, automation reduces manual review overhead and ensures consistent code quality without requiring manual format corrections.

Why does Terraform code organization matter for multi-environment projects?

Logical file and resource organization based on dependencies reduces deployment errors and accelerates onboarding. Clear structure enables teams to understand resource relationships, simplifies reviews, supports environment-specific configurations, and reduces technical debt by establishing a single source of truth for coding standards.