docs: guide for adding custom policy checks to Terraform stack pipelines - #56
docs: guide for adding custom policy checks to Terraform stack pipelines#56devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: brandon <brandon@flightcontrol.dev>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| ref: << pipeline.input.ref >> | ||
| base_path: << pipeline.input.base_path >> | ||
| commands: | ||
| - pip3 install --quiet checkov |
There was a problem hiding this comment.
Unpinned policy-tool installation
Installing the latest Checkov release on every run makes enforcement non-reproducible: a package release or registry outage can change policy results or block stack changes without any pipeline configuration change. Pin a tested version or otherwise use a controlled tool artifact.
Prompt To Fix With AI
This is a comment left during a code review.
Path: guides/terraform-policy-checks.mdx
Line: 101
Comment:
**Unpinned policy-tool installation**
Installing the latest Checkov release on every run makes enforcement non-reproducible: a package release or registry outage can change policy results or block stack changes without any pipeline configuration change. Pin a tested version or otherwise use a controlled tool artifact.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fair point — fixed in 47a1842. The example now installs checkov==3.3.11, and the notes below it call out pinning explicitly, so readers don't copy an unpinned install into an enforcement path.
Co-Authored-By: brandon <brandon@flightcontrol.dev>
Runtime verification in local Mintlify preview ✅Tested on New guide: /guides/terraform-policy-checksSidebar entry Terraform policy checks appears in the Guides group and is highlighted; title/description render; the Mermaid flow renders as an SVG;
In-page anchors (4/4 jump to the right heading)
Cross-links (7/7 load real pages)
Edited pages still render (regression)
Tested by Devin — session |
Summary
New guide
guides/terraform-policy-checkscovering the full path platform teams have to walk today: copy a system stack pipeline, insert a policycustomstep betweenplanandapprove, and point stacks at the copy via thechange_pipeline_id/destroy_pipeline_iddefault values at org, project, or environment scope.The load-bearing details, all verified against
shared-go/services/default_pipelineandshared-go/services/stackrun:customstep exiting nonzero beforeapprovemeans nothing reachesterraform:apply.inputs, thestandardvariant (resolveStackRunVariantAndInputsfails if the stack's requested variant is missing),plan_file_uri: << steps.plan.output.plan_file_uri >>, and theautoapproveinput (addAutoapproveInputIfSupportedonly injects it when the pipeline declares it).plan_file_uriis an S3 URI to a binary plan, so plan-based rules additionally need the same tool/version, an initialized dir, and bucket read access viainfrastructure.permissions.attach. The guide says so rather than implying the URI is a local path.Two accuracy fixes fell out of the research:
modules/stack.mdxdocumented system pipeline IDspipe_system_tf_change_pipeline/pipe_system_tf_destroy_pipeline, which don't exist. System pipelines are seeded with generatedpipe_...IDs; only the given IDstf-change-pipeline/tf-destroy-pipelineare stable, so the table now lists names + given IDs and tells you to read the ID fromravion pipeline list.pipelines/templating.mdxclaimed "there are no operators", but expressions are evaluated withexpr-langand the system pipelines themselves use<<steps.plan.output.has_changes && !pipeline.input.autoapprove>>. Now documents boolean/comparison operators, with adestroy_count > 0approval-gate example.mint validate,mint broken-links, and the OG-image check all pass.Link to Devin session: https://app.devin.ai/sessions/539c3dd601e7481090f600e108e81ff5
Requested by: @flybayer
Greptile Summary
The PR adds a guide for extending Ravion’s Terraform stack pipelines with custom policy checks and corrects related system-pipeline identifiers and templating documentation.
Confidence Score: 4/5
The PR appears safe to merge, with a non-blocking reproducibility concern in the policy-step example.
The documentation flow and command contracts are coherent, but installing an unconstrained Checkov release during every run allows policy behavior or availability to change without a pipeline-config change.
Files Needing Attention: guides/terraform-policy-checks.mdx
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR Copy[Copy system pipeline] --> Insert[Insert custom policy step] Insert --> Configure[Apply custom pipeline config] Configure --> Default[Set scoped pipeline default] Default --> Plan[Terraform plan] Plan --> Policy[Policy check] Policy -->|exit 0| Approval[Approval] Policy -->|nonzero exit| Failed[Run failed] Approval --> Apply[Terraform apply]Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "docs: guide for adding custom policy che..." | Re-trigger Greptile