
Terraform Style Guide
DevOpsby hashicorp
3/3 audits passMPL-2.0
Generate Terraform HCL code following HashiCorp's official style conventions and best practices. Use when writing, reviewing, or generating Terraform configurations.
Terraform Style Guide, published by HashiCorp, teaches an agent to write HCL that follows HashiCorp's official style conventions. It sets a code generation order: provider configuration and version constraints first, data sources before dependent resources, resources in dependency order, outputs for key attributes, and variables for every configurable value. It prescribes a file layout (terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf, locals.tf), two-space indentation with aligned equals signs, meta-arguments before arguments and blocks with lifecycle last, and naming rules such as lowercase with underscores, singular nouns and main where a single instance needs no descriptive name. Every variable must carry a type and description.
Use it when writing, reviewing or generating Terraform configurations and you want output that reads like HashiCorp's own examples. It is a style and structure guide rather than a troubleshooting tool, so it does not diagnose state problems or failed applies.
This is a skill for coding agents like Claude Code. It is published by HashiCorp under the MPL-2.0 licence and can be imported into BusinessMCP, where it has no direct connection to business data.
What you can do with it
- Generate a new Terraform config in HashiCorp's file layout
- Review HCL for naming and formatting issues
- Add type and description to every variable
- Order meta-arguments, arguments and blocks consistently
Run it on your business data
Imported into BusinessMCP, Terraform Style Guide becomes a playbook your AI business analyst applies to your connected GitHub repositories.
Use Terraform Style Guide in BusinessMCPInstall it in a coding agent
One command adds Terraform Style Guide to your project.
npx skills add https://github.com/hashicorp/agent-skills --skill terraform-style-guideHow we vetted it
- Source
- hashicorp/agent-skills at 516354c
- Licence
- MPL-2.0
- Security audits (skills.sh)
- Gen Agent Trust Hub: Pass · Socket: Pass · Snyk: Pass
- Bundled scripts
- None, instructions only
Checked 2026-09-25 against its skills.sh listing. How we vet skills
Related skills
All skillsTerraform Skill
Use when writing, reviewing, or debugging Terraform/OpenTofu modules, tests, CI, scans, or state ops - diagnoses failure mode (identity churn, secrets, blast radius, CI drift, state corruption) with version-aware guards.
AWS CDK Development
AWS Cloud Development Kit (CDK) expert for building cloud infrastructure with TypeScript/Python.
Azure Deploy
Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files.
Frequently asked questions
What file layout does the Terraform Style Guide recommend?
terraform.tf for version requirements, providers.tf, main.tf for resources and data sources, variables.tf and outputs.tf in alphabetical order, and locals.tf.
Does it fix Terraform state or apply errors?
No. It covers style and structure; for diagnosing state, CI drift or destroy problems a skill like Terraform Skill is a better fit.
How do I install Terraform Style Guide?
Run `npx skills add hashicorp/agent-skills --skill terraform-style-guide`, or import it from the BusinessMCP dashboard.
Run Terraform Style Guide against your whole business
Free plan, no credit card.
Use Terraform Style Guide in BusinessMCP