terraform-style-guide
Generate Terraform HCL code following HashiCorp's official style conventions and best practices. Use when writing, reviewing, or generating Terraform configurations.
Security Assessment
Detected risks:
About terraform-style-guide
The `terraform-style-guide` skill is designed to help users generate and maintain Terraform HCL code that adheres strictly to HashiCorp's official style conventions and best practices. It addresses the common challenge of inconsistent Terraform code, which can lead to maintainability issues, deployment errors, and reduced readability in infrastructure-as-code projects. By providing structured guidance on code organization, naming conventions, and formatting standards, this skill ensures that Terraform configurations are clear, standardized, and easier to manage across teams and projects.
This skill offers comprehensive features for Terraform code generation and review. It guides users through proper provider configuration, data source ordering, resource dependency management, and output declarations. It defines a clear file organization strategy, including dedicated files for variables, outputs, locals, providers, and main resources. The skill also emphasizes proper code formatting with consistent indentation, alignment, and block structuring. Naming conventions for resources and variables are specified to ensure clarity and uniformity. Additionally, it enforces complete variable and output definitions with descriptions, types, and validation rules to improve reliability and maintainability of Terraform configurations.
`terraform-style-guide` is ideal for DevOps engineers, cloud architects, and infrastructure teams who frequently write or review Terraform code. It is particularly useful for organizations aiming to enforce coding standards, improve collaboration, and reduce errors in cloud infrastructure deployments. Use cases include generating new Terraform modules, auditing existing configurations for style compliance, and standardizing infrastructure code across multiple environments or projects. By following this skill's guidelines, users can produce Terraform code that is more readable, maintainable, and aligned with industry best practices.
FAQ
How do I use this skill to generate Terraform code?
You can use the skill to create Terraform configurations by following the recommended code generation strategy, which includes defining provider settings, ordering data sources and resources, and declaring variables and outputs with descriptions and types.
Is this skill compatible with all Terraform versions?
The skill is designed to follow HashiCorp's style guide and works with Terraform version 1.14 or later, as indicated in the example configuration. Ensure that your Terraform version meets the required constraints in your project.
Can this skill help with reviewing existing Terraform code?
Yes, it provides guidelines for formatting, naming conventions, and file organization, which can be applied to audit and improve the style and readability of existing Terraform configurations.
Are there any limitations on the types of resources or providers supported?
The skill focuses on style and best practices rather than specific resources or providers. It can be applied to any Terraform-managed infrastructure, but the actual resource types must be supported by your Terraform version and providers.
Install terraform-style-guide
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
hashicorp/agent-skills