terraform-style-guide

Standardize Terraform configurations to HashiCorp's official style and file layout.

790|117|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/hashicorp/agent-skills --skill terraform-style-guide-hashicorp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-style-guide
Source: https://github.com/hashicorp/agent-skills/tree/main/terraform/code-generation/skills/terraform-style-guide
Command: npx skills add https://github.com/hashicorp/agent-skills --skill terraform-style-guide-hashicorp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams enforce HashiCorp's official Terraform style conventions, ensuring consistent formatting, naming, and project structure across Terraform configurations.

Core Features & Use Cases

  • Enforces standard file structure with terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf, and locals.tf.
  • Promotes clean naming conventions (lowercase with underscores) and descriptive variable and resource names.
  • Provides guidance on formatting, validation, and security best practices for Terraform projects.

Quick Start

Start by aligning your Terraform project to the standard file layout and naming conventions described in the guide. Use this skill to create or refactor configurations such as main.tf, variables.tf, and outputs.tf that follow the recommended structure and formatting.

Frequently Asked Questions about terraform-style-guide

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

FAQPage Schema
What is the standard file structure for Terraform projects?

The standard Terraform file structure organizes configurations into terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf, and locals.tf files. This layout enforces consistent infrastructure-as-code project structure and formatting guidelines.

How do I format Terraform code to follow HashiCorp naming conventions?

Terraform naming conventions require lowercase with underscores for clean variable and resource names. Applying these conventions alongside standard formatting guidelines ensures descriptive and consistent Terraform configurations across your project.

What are the best practices for writing descriptive Terraform variables and outputs?

Best practices for Terraform variables and outputs involve using descriptive definitions and standard file layouts. Enforcing these conventions ensures clear infrastructure-as-code formatting, structure, and security validation across your Terraform configurations.

How do I refactor existing Terraform code into a standard layout?

Refactoring Terraform code involves aligning configurations to the standard file layout by moving blocks into main.tf, variables.tf, and outputs.tf. This process applies naming conventions and formatting guidelines to existing infrastructure-as-code projects.

Does this Terraform style guide enforce security validation best practices?

Yes, the Terraform style guide provides guidance on formatting, validation, and security best practices. It enforces standard structure and naming conventions to maintain secure and consistent infrastructure-as-code configurations.