-
Notifications
You must be signed in to change notification settings - Fork 6
How To Run a Drift Gate
Huzefaaa2 edited this page May 8, 2026
·
1 revision
Use a drift gate when a pipeline must compare the current Terraform findings with an approved
snapshot before terraform apply.
The first run creates the approved snapshot for the selected snapshot_id.
terraform-guardrail enterprise drift-gate ./infra \
--provider aws \
--baseline org-baseline \
--snapshot-id prod \
--evidence-format pdf \
--format jsonExpected result:
-
statusisbaseline_created. - Decision is
passorwarndepending on findings. - Evidence is written when
--evidence-formatis set.
Run the same command in CI before apply. Terraform Guardrail compares the current findings to the stored snapshot.
terraform-guardrail enterprise drift-gate ./infra \
--provider aws \
--baseline org-baseline \
--snapshot-id prod \
--format jsonIf findings are added or removed, the gate returns block, includes drift_changed in the
reasons, and exits non-zero for CI.
Use strict mode when CI must fail if the snapshot does not already exist.
terraform-guardrail enterprise drift-gate ./infra \
--snapshot-id prod \
--no-create-snapshotUse this in the Guardrail stage before the apply stage:
terraform-guardrail enterprise drift-gate . \
--provider aws \
--baseline org-baseline \
--snapshot-id prod \
--evidence-format json \
--format jsonSee AWS CodePipeline for the full CodeBuild pattern.