terraform-style-guide

Enforces Terraform style and standards for project files and folders.

1|Updated Nov 1, 2021
One-click install
npx skills add https://github.com/clowa/my-setup --skill terraform-style-guide-clowa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-style-guide
Source: https://github.com/clowa/my-setup/tree/main/opencode/skills/terraform-style-guide
Command: npx skills add https://github.com/clowa/my-setup --skill terraform-style-guide-clowa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Terraform configurations often diverge in structure, naming, and formatting across projects, making maintenance and reviews costly. This Skill provides a centralized style guide to ensure consistent Terraform code.

Core Features & Use Cases

  • Code Structure: Standardizes file organization (providers.tf, main.tf, variables.tf, outputs.tf, locals.tf).
  • Naming & Typing: Enforces descriptive names with underscores and explicit variable types with validations.
  • Validation & Security: Promotes terraform fmt, terraform validate, and explicit version pinning for stable deployments.
  • Use Case: A multi-team project can align module authors to a single structure, enabling smoother reviews and deployments.

Quick Start

Create a new Terraform project that follows the guide: set up a providers.tf with required_providers, create main.tf with a simple resource, and define variables.tf and outputs.tf with types and descriptions; then run terraform fmt -recursive and terraform validate.

Frequently Asked Questions about terraform-style-guide

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

FAQPage Schema
How do I enforce Terraform naming conventions and code structure across multiple teams?

You can enforce Terraform naming conventions by standardizing file organization into providers.tf, main.tf, variables.tf, and outputs.tf, ensuring descriptive names with underscores and explicit variable types for consistent module reviews.

What is the best way to structure Terraform configurations for maintainability?

The best way to structure Terraform configurations is to separate files by purpose (providers, main, variables, outputs, locals) and apply explicit version pinning to ensure stable deployments and reduce maintenance costs across projects.

How do I set up a new Terraform project that follows official style best practices?

To set up a Terraform project following best practices, create a providers.tf with required_providers, define resources in main.tf, declare typed variables in variables.tf, add outputs.tf, then run terraform fmt -recursive and terraform validate.

Does this Terraform style guide require specific tools for validation?

No specific external tools are required beyond standard Terraform commands. The guide promotes using terraform fmt for formatting and terraform validate to check configurations against codified structural and naming rules.

Why do my Terraform configurations diverge in structure during code reviews?

Terraform configurations diverge in structure during reviews when teams lack a centralized style guide, making maintenance costly and causing inconsistent variable declarations, output definitions, and formatting rules across different modules.