# terraform-stacks

Guides AI coding assistants through HashiCorp Terraform Stacks syntax, component definitions, and multi-environment deployment configs.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 5600 installs · ★ 909
- Author: hashicorp
- License: MPL-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/hashicorp/agent-skills/tree/HEAD/plugins/terraform/skills/terraform-stacks/SKILL.md
- Updated: 2026-10-05
- HTML: https://affpapa.org/en/nevibecode/skills/terraform-stacks

## What it does

This skill teaches coding assistants how to write HashiCorp Stacks configurations properly. Traditional Terraform modules sit beneath Stacks, which use their own HCL files named `.tfcomponent.hcl` and `.tfdeploy.hcl`. All configurations belong at the repository root. The skill clarifies how to wire components together from Git repositories, registry sources, or local module paths.

Stack syntax brings noticeable differences from standard Terraform. Providers accept a `for_each` argument and hold settings inside a `config` block, while block headers carry aliases. Variable definitions require a strict `type` attribute. Setting `ephemeral = true` prevents credentials from landing in state files.

Workload identity via OIDC is the recommended path for cloud access. Stacks CLI features fail on engines older than Terraform 1.13.x, which makes the root `.terraform-version` file mandatory before testing CLI runs.

## Requirements
- Works with: Terraform

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-stacks -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/terraform-stacks/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/terraform-stacks/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-stacks -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/terraform-stacks/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-stacks -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/terraform-stacks/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install hashicorp/agent-skills terraform-stacks
```

2. **Manually: put the files in place**
- File: `.github/skills/terraform-stacks/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-stacks -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/hashicorp/agent-skills --path plugins/terraform/skills/terraform-stacks
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/terraform-stacks/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-stacks -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/hashicorp/agent-skills/tree/HEAD/plugins/terraform/skills/terraform-stacks/SKILL.md

## When to use it
- write component declarations inside .tfcomponent.hcl files
- configure multi-region deployments with .tfdeploy.hcl
- set up ephemeral variables for cloud identity tokens
- reference module sources across registries and Git repositories

## Example prompts
- Create a components.tfcomponent.hcl file referencing our VPC module in a private registry
- Show how to configure an AWS provider with for_each and assume_role_with_web_identity
- Validate this .tfdeploy.hcl setup for staging and production deployments

## Similar
- [terraform-skill](https://affpapa.org/en/nevibecode/skills/terraform-skill.md) — skill · 7400 installs
- [terraform-patterns](https://affpapa.org/en/nevibecode/skills/terraform-patterns.md) — skill · 617 installs
- [terraform-generator](https://affpapa.org/en/nevibecode/skills/terraform-generator.md) — skill · 639 installs
- [terraform-validator](https://affpapa.org/en/nevibecode/skills/terraform-validator.md) — skill · 640 installs
- [huawei-cloud-terraform-installer](https://affpapa.org/en/nevibecode/skills/huawei-cloud-terraform-installer.md) — skill · 17400 installs
- [huawei-cloud-terraform-generator](https://affpapa.org/en/nevibecode/skills/huawei-cloud-terraform-generator.md) — skill · 17000 installs

From the same set: [hashicorp/agent-skills](https://affpapa.org/en/nevibecode/by/hashicorp/agent-skills.md) — 20 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
