Individual skill
terraform-policy
Write, test, or convert Terraform Policy files (.policy.hcl, .policytest.hcl, Sentinel→tfpolicy). Triggers: policy.hcl, policytest, convert sentinel, tfpolicy, write a policy.
plugins/terraform/skills/terraform-policy/SKILL.md
Source commit 5e30fa5c867ba6777c37e4206babfd08049c396f
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- No
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Not checked yet
- Last checked
- Nov 4, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 922
- Repository last updated
- Nov 4, 2026
- License
- MPL-2.0
Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.
- doormat-managed Repository topic
- devops Derived category
- testing Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
.gitignoreasset · 29 bytesREADME.mddoc · 2,822 bytesSKILL.mdcore · 6,431 bytesSKILL.mdcore · 6,431 bytesSKILL.mdcore · 6,431 bytesexamples/README.mddoc · 2,592 bytesexamples/conversion/cloudfront-associated-with-waf/README.mddoc · 871 bytesexamples/conversion/cloudfront-associated-with-waf/cloudfront-associated-with-waf.policy.hclasset · 589 bytesexamples/conversion/cloudfront-associated-with-waf/cloudfront-associated-with-waf.sentinelasset · 1,613 bytesexamples/conversion/cloudtrail-server-side-encryption-enabled/README.mddoc · 846 bytesexamples/conversion/cloudtrail-server-side-encryption-enabled/cloudtrail-server-side-encryption-enabled.policy.hclasset · 512 bytesexamples/conversion/cloudtrail-server-side-encryption-enabled/cloudtrail-server-side-encryption-enabled.sentinelasset · 1,466 bytesexamples/conversion/dms-endpoint-should-be-ssl-configured/README.mddoc · 872 bytesexamples/conversion/dms-endpoint-should-be-ssl-configured/dms-endpoint-should-be-ssl-configured.policy.hclasset · 516 bytesexamples/conversion/dms-endpoint-should-be-ssl-configured/dms-endpoint-should-be-ssl-configured.sentinelasset · 1,547 bytesexamples/conversion/dms-endpoints-should-use-ssl/README.mddoc · 800 bytesexamples/conversion/dms-endpoints-should-use-ssl/dms-endpoints-should-use-ssl.policy.hclasset · 579 bytesexamples/conversion/dms-endpoints-should-use-ssl/dms-endpoints-should-use-ssl.sentinelasset · 1,421 bytesexamples/conversion/ec2-network-acl-should-have-subnet-ids/README.mddoc · 970 bytesexamples/conversion/ec2-network-acl-should-have-subnet-ids/ec2-network-acl-should-have-subnet-ids.policy.hclasset · 1,035 bytesexamples/conversion/ec2-network-acl-should-have-subnet-ids/ec2-network-acl-should-have-subnet-ids.sentinelasset · 2,941 bytesexamples/conversion/ec2-vpc-default-security-group-no-traffic/README.mddoc · 1,107 bytesexamples/conversion/ec2-vpc-default-security-group-no-traffic/ec2-vpc-default-security-group-no-traffic.policy.hclasset · 865 bytesexamples/conversion/ec2-vpc-default-security-group-no-traffic/ec2-vpc-default-security-group-no-traffic.sentinelasset · 3,658 bytesexamples/conversion/efs-access-point-should-enforce-user-identity/README.mddoc · 727 bytesexamples/conversion/efs-access-point-should-enforce-user-identity/efs-access-point-should-enforce-user-identity.policy.hclasset · 448 bytesexamples/conversion/efs-access-point-should-enforce-user-identity/efs-access-point-should-enforce-user-identity.sentinelasset · 1,336 bytesexamples/conversion/elasticache-redis-replication-group-encryption-at-transit-enabled/README.mddoc · 777 bytesexamples/conversion/elasticache-redis-replication-group-encryption-at-transit-enabled/elasticache-redis-replication-group-encryption-at-transit-enabled.policy.hclasset · 547 bytesexamples/conversion/elasticache-redis-replication-group-encryption-at-transit-enabled/elasticache-redis-replication-group-encryption-at-transit-enabled.sentinelasset · 1,532 bytesexamples/conversion/elasticsearch-encrypted-at-rest/README.mddoc · 734 bytesexamples/conversion/elasticsearch-encrypted-at-rest/elasticsearch-encrypted-at-rest.policy.hclasset · 584 bytesexamples/conversion/elasticsearch-encrypted-at-rest/elasticsearch-encrypted-at-rest.sentinelasset · 1,571 bytesexamples/conversion/elasticsearch-https-required/README.mddoc · 904 bytesexamples/conversion/elasticsearch-https-required/elasticsearch-https-required.policy.hclasset · 1,132 bytesexamples/conversion/elasticsearch-https-required/elasticsearch-https-required.sentinelasset · 2,352 bytesexamples/conversion/elasticsearch-in-vpc-only/README.mddoc · 890 bytesexamples/conversion/elasticsearch-in-vpc-only/elasticsearch-in-vpc-only.policy.hclasset · 589 bytesexamples/conversion/elasticsearch-in-vpc-only/elasticsearch-in-vpc-only.sentinelasset · 1,935 bytesexamples/conversion/eventbridge-custom-event-bus-should-have-attached-policy/README.mddoc · 1,103 bytesexamples/conversion/eventbridge-custom-event-bus-should-have-attached-policy/eventbridge-custom-event-bus-should-have-attached-policy.policy.hclasset · 845 bytesexamples/conversion/eventbridge-custom-event-bus-should-have-attached-policy/eventbridge-custom-event-bus-should-have-attached-policy.sentinelasset · 2,125 bytesexamples/conversion/s3-block-public-access-bucket-level/README.mddoc · 1,123 bytesexamples/conversion/s3-block-public-access-bucket-level/s3-block-public-access-bucket-level.policy.hclasset · 1,184 bytesexamples/conversion/s3-block-public-access-bucket-level/s3-block-public-access-bucket-level.sentinelasset · 3,304 bytesexamples/conversion/s3-bucket-should-have-object-lock-enabled/README.mddoc · 975 bytesexamples/conversion/s3-bucket-should-have-object-lock-enabled/s3-bucket-should-have-object-lock-enabled.policy.hclasset · 1,030 bytesexamples/conversion/s3-bucket-should-have-object-lock-enabled/s3-bucket-should-have-object-lock-enabled.sentinelasset · 2,868 bytesexamples/conversion/secretsmanager-auto-rotation-enabled-check/README.mddoc · 955 bytesexamples/conversion/secretsmanager-auto-rotation-enabled-check/secretsmanager-auto-rotation-enabled-check.policy.hclasset · 867 bytesexamples/conversion/secretsmanager-auto-rotation-enabled-check/secretsmanager-auto-rotation-enabled-check.sentinelasset · 2,250 bytesexamples/conversion/step-functions-state-machine-logging-enabled/README.mddoc · 778 bytesexamples/conversion/step-functions-state-machine-logging-enabled/step-functions-state-machine-logging-enabled.policy.hclasset · 724 bytesexamples/conversion/step-functions-state-machine-logging-enabled/step-functions-state-machine-logging-enabled.sentinelasset · 1,594 bytesreferences/tfpolicy-author.mddoc · 104,578 bytesreferences/tfpolicy-test.mddoc · 47,617 bytesreferences/verified-syntax.mddoc · 103,651 bytes
Read excerpt
# 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.4.x` and `0.5.x`. The `0.3.x` bullet below is baseline guidance that applies to every supported line. When a new minor ships, drop the oldest line and add the new one. Inline notes for versions earlier than `0.3.0` are retained only for older CLIs.
- If the CLI is `0.3.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. 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 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 strings outside Stack evaluations on 0.3.x and 0.4.x (`null` on 0.5.x+, see below). On 0.3.x only, the `no-op` operation does not exist: resource policies evaluate only resources that the run creates, updates, or deletes, and the default `operations` is `["create", "update"]`.
- If the CLI is `0.4.x` or newer, all `0.3.x` guidance still applies except the `operations` default, plus the `no-op` operation, which evaluates resources that the run leaves unchanged (the entire state). `operations` accepts `"create"`, `"update"`, `"delete"`, and `"no-op"`. For policies that do not reference `prior_attrs`, the default `operations` is now `["create", "update", "no-op"]`, so omitting it evaluates every resource in state. Use `operations = ["create", "update"]` to evaluate only changed resources. `no-op` exposes the existing values through `attrs`, and `prior_attrs` is unavailable. `delete` cannot be combined with `create` or `no-op` (`["update", "delete"]` is valid), and `prior_attrs` policies must set `operations` explicitly. Attrs-only policies (no `prior_attrs`) calling `core::getresources` whose `operations` omit `no-op` load with a warning; do not add `no-op` to a `prior_attrs` policy, which fails validation. In tests, set `meta.operation = "no-op"` explicitly because it is never inferred (see [tfpolicy-author](references/tfpolicy-author.md#operation-scoping-and-prior_attrs) and [tfpolicy-test](references/tfpolicy-test.md#testing-operation-aware-policies)).