terraform-policy
Skill by hashicorp
Writes, tests, and converts Terraform Policy files, including .policy.hcl policies, .policytest.hcl tests, and Sentinel policies. It is for engineers working with tfpolicy who need version-aware guidance.
Install terraform-policy
Built from the published package, never by AI.
git clone --depth 1 https://github.com/hashicorp/agent-skills /tmp/agent-skills && mkdir -p ~/.claude/skills && cp -r /tmp/agent-skills/plugins/terraform/skills/terraform-policy ~/.claude/skills/terraform-policyRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/hashicorp/agent-skills /tmp/agent-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/agent-skills/plugins/terraform/skills/terraform-policy ~/.gemini/antigravity-cli/skills/terraform-policyAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
terraform-policy is a utility skill from HashiCorp for writing, testing, and converting Terraform Policy files. It covers .policy.hcl policy files, .policytest.hcl test files, and converting or migrating Sentinel (.sentinel) policies to tfpolicy. It routes requests to two sub-skills: tfpolicy-author for policy files and tfpolicy-test for test files.
Before giving guidance, the skill checks the installed tfpolicy CLI version and tailors its advice for the 0.3.x, 0.4.x and 0.5.x lines, since behavior such as default operations and null meta attributes differs between them. It is aimed at engineers writing Terraform policies. It does not cover .tftest.hcl module tests or general Terraform HCL authoring.
Written from the project's SKILL.md and checked against it.
What it can do
- Write policy filesWrites a new .policy.hcl policy from a description or requirement.
- Convert Sentinel policiesConverts a .sentinel policy to Terraform Policy.
- Write and debug testsWrites or debugs a .policytest.hcl test file.
- Migrate Sentinel librariesMigrates a Sentinel policy library to Terraform Policy.
- Version-aware guidanceTailors authoring and testing advice to the installed tfpolicy CLI version.
What you need
- Installed tfpolicy CLI, checked for version 0.3.x, 0.4.x or 0.5.x
- Existing Sentinel policy files, for conversion tasks
Try asking
- Write a tfpolicy that blocks EC2 instances without encryption
- Convert this Sentinel policy to tfpolicy
- Write a policytest for my EBS policy
Good to know
- Does not write .tftest.hcl files for Terraform modules; use terraform-test for those.
- Does not cover general Terraform HCL authoring; use terraform-style-guide.
- On 0.3.x, version-range validation is best effort and wildcard targets are not schema-validated.
- If the CLI version is unknown, the user is asked to check it first.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: plugins/terraform/skills/terraform-policy/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
.gitignore29 B -
README.md3 KB -
SKILL.md6 KB -
examples/README.md3 KB -
examples/conversion/cloudfront-associated-with-waf/README.md871 B
Show all 55 files
-
examples/conversion/cloudfront-associated-with-waf/cloudfront-associated-with-waf.policy.hcl589 B -
examples/conversion/cloudfront-associated-with-waf/cloudfront-associated-with-waf.sentinel2 KB -
examples/conversion/cloudtrail-server-side-encryption-enabled/README.md846 B -
examples/conversion/cloudtrail-server-side-encryption-enabled/cloudtrail-server-side-encryption-enabled.policy.hcl512 B -
examples/conversion/cloudtrail-server-side-encryption-enabled/cloudtrail-server-side-encryption-enabled.sentinel1 KB -
examples/conversion/dms-endpoint-should-be-ssl-configured/README.md872 B -
examples/conversion/dms-endpoint-should-be-ssl-configured/dms-endpoint-should-be-ssl-configured.policy.hcl516 B -
examples/conversion/dms-endpoint-should-be-ssl-configured/dms-endpoint-should-be-ssl-configured.sentinel2 KB -
examples/conversion/dms-endpoints-should-use-ssl/README.md800 B -
examples/conversion/dms-endpoints-should-use-ssl/dms-endpoints-should-use-ssl.policy.hcl579 B -
examples/conversion/dms-endpoints-should-use-ssl/dms-endpoints-should-use-ssl.sentinel1 KB -
examples/conversion/ec2-network-acl-should-have-subnet-ids/README.md970 B -
examples/conversion/ec2-network-acl-should-have-subnet-ids/ec2-network-acl-should-have-subnet-ids.policy.hcl1 KB -
examples/conversion/ec2-network-acl-should-have-subnet-ids/ec2-network-acl-should-have-subnet-ids.sentinel3 KB -
examples/conversion/ec2-vpc-default-security-group-no-traffic/README.md1 KB -
examples/conversion/ec2-vpc-default-security-group-no-traffic/ec2-vpc-default-security-group-no-traffic.policy.hcl865 B -
examples/conversion/ec2-vpc-default-security-group-no-traffic/ec2-vpc-default-security-group-no-traffic.sentinel4 KB -
examples/conversion/efs-access-point-should-enforce-user-identity/README.md727 B -
examples/conversion/efs-access-point-should-enforce-user-identity/efs-access-point-should-enforce-user-identity.policy.hcl448 B -
examples/conversion/efs-access-point-should-enforce-user-identity/efs-access-point-should-enforce-user-identity.sentinel1 KB -
examples/conversion/elasticache-redis-replication-group-encryption-at-transit-enabled/README.md777 B -
examples/conversion/elasticache-redis-replication-group-encryption-at-transit-enabled/elasticache-redis-replication-group-encryption-at-transit-enabled.policy.hcl547 B -
examples/conversion/elasticache-redis-replication-group-encryption-at-transit-enabled/elasticache-redis-replication-group-encryption-at-transit-enabled.sentinel1 KB -
examples/conversion/elasticsearch-encrypted-at-rest/README.md734 B -
examples/conversion/elasticsearch-encrypted-at-rest/elasticsearch-encrypted-at-rest.policy.hcl584 B
And 25 more files on GitHub.
Alternatives to terraform-policy
All alternatives →Runs the full Next.js deployment test suite for an internal vercel/next.js pull request. It validates the commit's preview package, then dispatches the test_e2e_deploy_release.yml workflow. Meant for maintainers who explicitly ask for the entire suite.
Instruments Python AI applications with DeepEval's native tracing so their execution appears span by span in Confident AI's Observatory. It is for developers building LLM apps, agents, RAG pipelines and chatbots.
Manages Azure Container Registry through the az acr Azure CLI command group. It covers registries, images, cloud builds, ACR Tasks, tokens, geo-replication and networking. Built for developers and operators who work with ACR in Azure.
Opens, runs, and shows apps on a temporary Crabbox machine, including native desktops and web previews. It is for OpenClaw users who want an app running and visible in their chat side panel.
Runs batch and HPC workloads on GKE using job queues and parallel processing. Aimed at teams running batch pipelines, HPC simulations, or ML training jobs on Google Kubernetes Engine.
Answers questions about GKE cluster and workload costs using BigQuery billing exports and live cluster metrics. Built for platform engineers and cloud teams who need to analyze and diagnose GKE spend.
Compare with deploy-release-test, deepeval-tracing or azure-container-registry-cli
terraform-policy: common questions
What file types does terraform-policy support?
It supports .policy.hcl policy files and .policytest.hcl test files. It can also convert Sentinel .sentinel policies to Terraform Policy.
Which tfpolicy CLI versions are covered?
The skill maintains guidance for the 0.4.x and 0.5.x lines, and 0.3.x guidance applies to every supported line. When a new minor version ships, the oldest line is dropped.
Can it write tests for Terraform modules?
No. Writing .tftest.hcl files for Terraform modules is handled by the terraform-test skill.
How do I install terraform-policy?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is terraform-policy free?
The code is published under the MPL-2.0 licence. The service it connects to may have its own pricing.
Is terraform-policy safe to use?
It scores 78 of 100. Grades: maintenance B, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to terraform-policy?
Similar skills: deploy-release-test, deepeval-tracing, azure-container-registry-cli, crabbox-apps.
