Agent skill · hashicorp

terraform-style-guide

Generate Terraform HCL code following HashiCorp's official style conventions and best practices. Use when writing, reviewing, or generating Terraform configurations.

What it needs

About 4k tokens when loaded.

What this skill does

Terraform Style Guide Generate and maintain Terraform code following HashiCorp's official style conventions and best practices. Reference: HashiCorp Terraform Style Guide Code Generation Strategy When generating Terraform code: 1. Start with provider configuration and version constraints 2. Create data sources before dependent resources 3. Build resources in dependency order 4. Add outputs for key resource attributes 5. Use variables for all configurable values File Organization File Purpose ------ --------- terraform.tf Terraform and provider version requirements providers.tf Provider configurations main.tf Primary resources and data sources variables.tf Input variable declarations (alphabetical) outputs.tf Output value declarations (alphabetical) locals.tf Local value declarations Example Structure Code Formatting Indentation and Alignment Use two spaces per nesting level (no tabs) Align equals signs for consecutive arguments Block Organization Arguments precede blocks, with meta-arguments first: Naming Conventions Use lowercase with underscores for all names Use descriptive nouns excluding the resource type Be specific and meaningful Resource names must be singular, not plural Default to main for resources where a specific descriptive name is redundant or unavailable, provided only one instance exists Variables Every variable must include type and description: Outputs Every output must include description: Dynamic Resource Creation Prefer foreach over count count for Conditional Creation Security Best Practices Refer to SECURITY.md. It includes guidance on encrypting resources, preventing sensitive data in state, and secure configurations. Version Pinning Use the latest major version of each provider and the latest minor version of Terraform, unless otherwise constrained by a dependency lock file or by other modules used by the configuration. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills hashicorp/terraform-style-guide--c2a4b7

View the source on GitHub

Browse the @skills marketplace