terraform-style-guide

Enforce HashiCorp Terraform style conventions across codebases.

Updated Jul 30, 2024
One-click install
npx skills add https://github.com/twidxuga/dotfiles --skill terraform-style-guide-twidxuga
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-style-guide
Source: https://github.com/twidxuga/dotfiles/tree/main/opencode/dot-config/opencode/skills/terraform-style-guide
Command: npx skills add https://github.com/twidxuga/dotfiles --skill terraform-style-guide-twidxuga

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Terraform projects often suffer from inconsistent style and structure across teams, leading to slower reviews, higher risk of misconfigurations, and reduced maintainability.

Core Features & Use Cases

  • Enforces consistent Terraform style across files, including naming, formatting, and file organization.
  • Provides guidance for typical Terraform project scaffolding (variables.tf, main.tf, outputs.tf, locals.tf).
  • Use Case: when starting a new Terraform module or auditing an existing one to bring it into alignment with HashiCorp style guidelines.

Quick Start

Apply this style guide to a Terraform project by generating a compliant set of Terraform files (variables.tf, main.tf, outputs.tf, and locals.tf) with proper naming and formatting.

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 HashiCorp Terraform style conventions across my codebase?

You can enforce HashiCorp Terraform style conventions by applying standardized rules for file organization, variable and output declarations, formatting, and security best practices to ensure consistency and maintainability.

What is the recommended file organization for a Terraform module?

The recommended file organization for a Terraform module includes separating code into standard files: variables.tf, main.tf, outputs.tf, and locals.tf to align with HashiCorp style guidelines.

Can I use this style guide to audit an existing Terraform project?

Yes, you can audit an existing Terraform project by reviewing it against HashiCorp style guidelines to bring variable declarations, formatting rules, and file structure into compliance.

What's the best way to standardize Terraform naming conventions and formatting?

The best way to standardize Terraform naming conventions and formatting is to apply HashiCorp style rules that enforce consistent resource naming, variable declarations, and HCL formatting across files.

Why does inconsistent Terraform code structure increase review times?

Inconsistent Terraform code structure increases review times because non-standard file organization and formatting require extra effort to parse, raising the risk of misconfigurations and reducing maintainability.