terraform-style-guide

Generates Terraform HCL code following HashiCorp style conventions and security practices.

Updated Jun 13, 2026
One-click install
npx skills add https://github.com/jenreh/project-kit-template --skill terraform-style-guide-jenreh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-style-guide
Source: https://github.com/jenreh/project-kit-template/tree/main/.agents/agent-skills/skills/terraform-style-guide
Command: npx skills add https://github.com/jenreh/project-kit-template --skill terraform-style-guide-jenreh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Terraform configurations that are inconsistent, insecure, or hard to maintain leads to drift, review friction, and exposed secrets. This Skill enforces HashiCorp's official style conventions and security hardening rules whenever Terraform code is written or reviewed. ## Core Features & Use Cases - Style-Conformant Code Generation: Produces HCL with standard file organization (terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf), two-space indentation, aligned equals signs, and correct block ordering. - Naming and Structure Rules: Enforces lowercase-with-underscores naming, singular descriptive resource names, typed and described variables, and for_each over count for multiple resources. - Security Hardening: Applies encryption at rest, least-privilege networking, sensitive output marking, and ephemeral resources or write-only attributes to keep secrets out of state files. - Use Case: Ask for a new AWS VPC module and receive properly structured, version-pinned, validated HCL with encrypted resources and no hardcoded credentials, ready for terraform fmt and terraform validate. ## Quick Start Ask the assistant to generate a Terraform configuration for an AWS S3 bucket following the HashiCorp style guide with encryption and versioning enabled.

Frequently Asked Questions about terraform-style-guide

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

FAQPage Schema
How do I write Terraform code that follows HashiCorp style conventions?

Organize configuration into terraform.tf, providers.tf, main.tf, variables.tf, and outputs.tf files. Use two-space indentation, align equals signs, place meta-arguments first, and give every variable a type and description.

How do I keep secrets out of Terraform state files?

Use ephemeral resources and write-only attributes, available since Terraform 1.11, so sensitive values never persist in state. Prefer native secrets manager integration like AWS Secrets Manager when a resource supports it, and mark sensitive outputs with sensitive = true.

Should I use count or for_each in Terraform resources?

Use for_each with a set or map when creating multiple named resources, since it tracks instances by key and avoids reordering issues. Reserve count for simple conditional creation, such as enabling a resource with count = var.enabled ? 1 : 0.

What Terraform version is required for ephemeral resources?

Ephemeral resources require Terraform version 1.11.0 or later. Before generating ephemeral resource code, verify the Terraform version, and fall back to regular resources only when no write-only attribute or ephemeral alternative exists.

What files should never be committed to Terraform version control?

Never commit terraform.tfstate, terraform.tfstate.backup, the .terraform directory, .tfplan files, or .tfvars files containing sensitive data. Always commit all .tf configuration files and the .terraform.lock.hcl dependency lock file.