terraform-policy
Write, test, or convert Terraform Policy files (.policy.hcl, .policytest.hcl, Sentinel→tfpolicy).
Skill by hashicorpOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/hashicorp-terraform-policy
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, devops, writing, infrastructure-as-code
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/terraform-policy
What's inside
- Skill name
terraform-policy- Description
- Write, test, or convert Terraform Policy files (.policy.hcl, .policytest.hcl, Sentinel→tfpolicy). Triggers: policy.hcl, policytest, convert sentinel, tfpolicy, write a policy.
- License
- MPL-2.0
- Metadata
- version: 0.1.0 · copyright: Copyright IBM Corp. 2026 · lifecycle-status: active
- Instructions
- 44 lines in SKILL.md · view on GitHub
Files (55)
- .gitignore
- README.md
- SKILL.md
- README.md · examples/
- README.md · examples/conversion/cloudfront-associated-with-waf/
- cloudfront-associated-with-waf.policy.hcl · examples/conversion/cloudfront-associated-with-waf/
- cloudfront-associated-with-waf.sentinel · examples/conversion/cloudfront-associated-with-waf/
- README.md · examples/conversion/cloudtrail-server-side-encryption-enabled/
- cloudtrail-server-side-encryption-enabled.policy.hcl · examples/conversion/cloudtrail-server-side-encryption-enabled/
- cloudtrail-server-side-encryption-enabled.sentinel · examples/conversion/cloudtrail-server-side-encryption-enabled/
- README.md · examples/conversion/dms-endpoint-should-be-ssl-configured/
- dms-endpoint-should-be-ssl-configured.policy.hcl · examples/conversion/dms-endpoint-should-be-ssl-configured/
- dms-endpoint-should-be-ssl-configured.sentinel · examples/conversion/dms-endpoint-should-be-ssl-configured/
- README.md · examples/conversion/dms-endpoints-should-use-ssl/
- dms-endpoints-should-use-ssl.policy.hcl · examples/conversion/dms-endpoints-should-use-ssl/
- dms-endpoints-should-use-ssl.sentinel · examples/conversion/dms-endpoints-should-use-ssl/
- README.md · examples/conversion/ec2-network-acl-should-have-subnet-ids/
- ec2-network-acl-should-have-subnet-ids.policy.hcl · examples/conversion/ec2-network-acl-should-have-subnet-ids/
- ec2-network-acl-should-have-subnet-ids.sentinel · examples/conversion/ec2-network-acl-should-have-subnet-ids/
- README.md · examples/conversion/ec2-vpc-default-security-group-no-traffic/
- ec2-vpc-default-security-group-no-traffic.policy.hcl · examples/conversion/ec2-vpc-default-security-group-no-traffic/
- ec2-vpc-default-security-group-no-traffic.sentinel · examples/conversion/ec2-vpc-default-security-group-no-traffic/
- README.md · examples/conversion/efs-access-point-should-enforce-user-identity/
- efs-access-point-should-enforce-user-identity.policy.hcl · examples/conversion/efs-access-point-should-enforce-user-identity/
- efs-access-point-should-enforce-user-identity.sentinel · examples/conversion/efs-access-point-should-enforce-user-identity/
- README.md · examples/conversion/elasticache-redis-replication-group-encryption-at-transit-enabled/
- elasticache-redis-replication-group-encryption-at-transit-enabled.policy.hcl · examples/conversion/elasticache-redis-replication-group-encryption-at-transit-enabled/
- elasticache-redis-replication-group-encryption-at-transit-enabled.sentinel · examples/conversion/elasticache-redis-replication-group-encryption-at-transit-enabled/
- README.md · examples/conversion/elasticsearch-encrypted-at-rest/
- elasticsearch-encrypted-at-rest.policy.hcl · examples/conversion/elasticsearch-encrypted-at-rest/
- elasticsearch-encrypted-at-rest.sentinel · examples/conversion/elasticsearch-encrypted-at-rest/
- README.md · examples/conversion/elasticsearch-https-required/
- elasticsearch-https-required.policy.hcl · examples/conversion/elasticsearch-https-required/
- elasticsearch-https-required.sentinel · examples/conversion/elasticsearch-https-required/
- README.md · examples/conversion/elasticsearch-in-vpc-only/
- elasticsearch-in-vpc-only.policy.hcl · examples/conversion/elasticsearch-in-vpc-only/
- elasticsearch-in-vpc-only.sentinel · examples/conversion/elasticsearch-in-vpc-only/
- README.md · examples/conversion/eventbridge-custom-event-bus-should-have-attached-policy/
- eventbridge-custom-event-bus-should-have-attached-policy.policy.hcl · examples/conversion/eventbridge-custom-event-bus-should-have-attached-policy/
- eventbridge-custom-event-bus-should-have-attached-policy.sentinel · examples/conversion/eventbridge-custom-event-bus-should-have-attached-policy/
- README.md · examples/conversion/s3-block-public-access-bucket-level/
- s3-block-public-access-bucket-level.policy.hcl · examples/conversion/s3-block-public-access-bucket-level/
- s3-block-public-access-bucket-level.sentinel · examples/conversion/s3-block-public-access-bucket-level/
- README.md · examples/conversion/s3-bucket-should-have-object-lock-enabled/
- s3-bucket-should-have-object-lock-enabled.policy.hcl · examples/conversion/s3-bucket-should-have-object-lock-enabled/
- s3-bucket-should-have-object-lock-enabled.sentinel · examples/conversion/s3-bucket-should-have-object-lock-enabled/
- README.md · examples/conversion/secretsmanager-auto-rotation-enabled-check/
- secretsmanager-auto-rotation-enabled-check.policy.hcl · examples/conversion/secretsmanager-auto-rotation-enabled-check/
- secretsmanager-auto-rotation-enabled-check.sentinel · examples/conversion/secretsmanager-auto-rotation-enabled-check/
- README.md · examples/conversion/step-functions-state-machine-logging-enabled/
- step-functions-state-machine-logging-enabled.policy.hcl · examples/conversion/step-functions-state-machine-logging-enabled/
- step-functions-state-machine-logging-enabled.sentinel · examples/conversion/step-functions-state-machine-logging-enabled/
- tfpolicy-author.md · references/
- tfpolicy-test.md · references/
- verified-syntax.md · references/
SKILL.md (first lines)
# terraform-policy
**UTILITY SKILL** — INVOKES: [tfpolicy-author](references/tfpolicy-author.md) | [tfpolicy-test](references/tfpolicy-test.md)
## USE FOR:
- Writing a new `.policy.hcl` policy from a description or requirement
- Converting a `.sentinel` policy to Terraform Policy
- Writing or debugging a `.policytest.hcl` test file
- Migrating a Sentinel policy library to Terraform Policy
Before giving authoring or testing instructions, check the installed `tfpolicy` CLI version and tailor guidance accordingly. This skill maintains guidance for the two most recent minor lines, `0.2.x` and `0.3.x`; when a new minor ships, drop the oldest line and add the new one.
- If the CLI is `0.2.x` (baseline), include a top-level `policy { required_providers { ... } }` block when authoring `.policy.hcl` files containing resource or provider policies. It is mandatory for `tfpolicy validate`; version-range validation is best effort, and wildcard targets such as `resource_policy "*"` are not schema-validated. `tfpolicy test` does not preflight mocked `attrs`/`prior_attrs` against provider schemas, `core::alltrue`/`core::anytrue` do not exist, and, only in this `0.2.x` line, mock `resource {}` blocks may omit `attrs`/`prior_attrs` entirely.
- If the CLI is `0.3.x` or newer, the other guidance above still applies, but the `0.2.x` allowance for omitting resource state does not: every mock `resource {}` block in `.policytest.hcl` files must declare `attrs` or `prior_attrs`; if both evaluate to empty, the test case is skipped (`provider {}` and `module {}` mocks are unaffected) (see [tfpolicy-test](references/tfpolicy-test.md#every-resource--mock-must-declare-a-non-empty-state-block-tfpolicy-030)). `tfpolicy test` reuses the target `.policy.hcl`'s existing top-level `policy { required_providers { ... } }` block (there is no separate `.policytest.hcl`-level declaration) to validate provider, resource, and data-source policies and `core::getdatasource()`/`core::getresources()` arguments against resolved provider schemas before any test runs, failing the whole run on a schema mismatch (see [tfpolicy-test](references/tfpolicy-test.md#test-execution-behavior)). `core::alltrue(list)` and `core::anytrue(list)` are also available — prefer them over the `core::length()` list-comprehension workaround (see [tfpolicy-author](references/tfpolicy-author.md#core-functions--common-idioms)). `meta.tfe_stack` and `meta.tfe_workspace.tags` are available to resource, provider, and module policies; Stack fields are empty outside Stack evaluations.
- If the CLI version is unknown, ask the user to check it first or provide guidance that clearly distinguishes the `0.2.x` and `0.3.x` paths.
## DO NOT USE FOR:
- Writing `.tftest.hcl` files for Terraform modules — use `terraform-test`
- General Terraform HCL authoring — use `terraform-style-guide`
## Routing
| Task | Sub-skill |
|------|-----------|
| Write or convert a `.policy.hcl` policy | [tfpolicy-author](references/tfpolicy-author.md) |
| Write or debug a `.policytest.hcl` test | [tfpolicy-test](references/tfpolicy-test.md) |
## Examples
- "Block EC2 instances without encryption" → [tfpolicy-author](references/tfpolicy-author.md)
- "Convert this Sentinel policy to tfpolicy" → [tfpolicy-author](references/tfpolicy-author.md)
- "Write a policytest for my EBS policy" → [tfpolicy-test](references/tfpolicy-test.md)
## Troubleshooting
- **Wrong skill triggered?** Load the sub-skill directly from the routing table above.
```bash
npx skills add hashicorp/agent-skills/terraform/terraform-policy/skills/tfpolicy-author
npx skills add hashicorp/agent-skills/terraform/terraform-policy/skills/tfpolicy-test
```From hashicorp/agent-skills, MPL-2.0.
More from hashicorp/agent-skills
- 0.777score
provider-configuration
hashicorpOfficial
Implement Terraform provider configuration and authentication with the Plugin Framework: provider schema for credentials (Optional + Sensitive attributes)…
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
provider-docs
hashicorpOfficial
Create, update, and review Terraform provider documentation for Terraform Registry using HashiCorp-recommended patterns, tfplugindocs templates, and schema…
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
provider-test-patterns
hashicorpOfficial
Terraform provider acceptance test patterns using terraform-plugin-testing with the Plugin Framework.
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
provider-framework-migration
hashicorpOfficial
Migrate Terraform provider resources and data sources from Plugin SDKv2 to the Plugin Framework: muxing both plugins in one provider (terraform-plugin-mux…
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
terraform-search-import
hashicorpOfficial
Discover existing cloud resources using Terraform Search queries and bulk import them into Terraform management.
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
terraform-test
hashicorpOfficial
Comprehensive guide for writing and running Terraform tests.
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
terraform-stacks
hashicorpOfficial
Comprehensive guide for working with HashiCorp Terraform Stacks.
SkillBFreshness: B★ 907Claude Code +9 - 0.772score
push-to-registry
hashicorpOfficial
Push Packer build metadata to HCP Packer registry for tracking and managing image lifecycle.
SkillBFreshness: B★ 907Claude Code +9 - 0.772score
aws-ami-builder
hashicorpOfficial
Build Amazon Machine Images (AMIs) with Packer using the amazon-ebs builder.
SkillBFreshness: B★ 907Claude Code +9 - 0.772score
windows-builder
hashicorpOfficial
Build Windows images with Packer using WinRM communicator and PowerShell provisioners.
SkillBFreshness: B★ 907Claude Code +9 - 0.772score
new-terraform-provider
hashicorpOfficial
Use this when scaffolding a new Terraform provider with the Plugin Framework: workspace layout, go module setup, provider server main.go, and a provider.go…
SkillBFreshness: B★ 907Claude Code +9 - 0.772score
provider-ephemeral-resources
hashicorpOfficial
Implement Terraform provider ephemeral resources with the Plugin Framework: the Open/Renew/Close lifecycle, ephemeral schema design, registration via…
SkillBFreshness: B★ 907Claude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 907
- Forks
- 134
- Open issues
- 12
- Last commit (this folder)
- Sep 28, 2026 (29 days ago)
- Last release
- Aug 4, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 0.1.0
- License
- MPL-2.0
- Repository
- github.com/hashicorp/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from hashicorp
- 0.821score
Terraform
hashicorpOfficial
Generate more accurate Terraform and automate workflows for HCP Terraform and Terraform Enterprise
ConnectorAFreshness: ALocal★ 1.6KClaude Code +5 - 0.777score
terraform-stacks
hashicorpOfficial
Comprehensive guide for working with HashiCorp Terraform Stacks.
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
provider-configuration
hashicorpOfficial
Implement Terraform provider configuration and authentication with the Plugin Framework: provider schema for credentials (Optional + Sensitive attributes)…
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
provider-docs
hashicorpOfficial
Create, update, and review Terraform provider documentation for Terraform Registry using HashiCorp-recommended patterns, tfplugindocs templates, and schema…
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
terraform-search-import
hashicorpOfficial
Discover existing cloud resources using Terraform Search queries and bulk import them into Terraform management.
SkillBFreshness: B★ 907Claude Code +9 - 0.777score
provider-framework-migration
hashicorpOfficial
Migrate Terraform provider resources and data sources from Plugin SDKv2 to the Plugin Framework: muxing both plugins in one provider (terraform-plugin-mux…
SkillBFreshness: B★ 907Claude Code +9
Cite this page
terraform-policy skill. Agent Mart. https://agentmart.dev/skills/hashicorp-terraform-policy (last updated 2026-10-24)