fix(tfpolicy-author): Allow core::getdatasource() inside resource_policy - #92
fix(tfpolicy-author): Allow core::getdatasource() inside resource_policy#92jweigand wants to merge 2 commits into
Conversation
…icy when filter depends on attrs.* The skill previously banned core::getdatasource() inside resource_policy outright, which blocked legitimate per-resource external validations (e.g. verifying an AMI's owner, a KMS key's policy) whose filter is necessarily derived from the resource's own attrs.* and can't be hoisted to a top-level locals cache. Replaces the blanket rule with the same literal-vs-attrs.*-dependent decision guide already used for core::getresources(), plus a worked example and updated "Mistake 14" writeup in verified-syntax.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Direction makes sense — the blanket ban did block legitimate per-resource checks, and mirroring the
Nit: item 9 says wrap the result in |
The tfpolicy-author skill unconditionally instructed agents to avoid core::getdatasource() inside resource_policy blocks ("it calls provider APIs"). It blocked legitimate, necessary uses: validations where the datasource filter is derived from the current resource's own attributes (e.g., confirming attrs.ami is owned by an approved account, or attrs.kms_key_id has a required key policy) genuinely can't be pre-computed in a top-level locals block, since attrs is only available inside resource_policy.
This mirrors the existing, more nuanced guidance the skill already has for core::getresources(): cache at the top level when the filter is a static/literal value, but call inline within resource_policy when the filter depends on the resource being evaluated
Changes:
Why: Without this, the skill refuses to write policies that need live, resource-specific provider validation which is a valid use case per the getdatasource() docs.