Fan-out gate: stop a PR that would trigger runs on many stacks before the runs start
Problem
When a PR touches a shared file (a module, a Terragrunt root .hcl, shared variables), Spacelift resolves the affected stacks and triggers a run on each. Push policies decide per stack, so none of them can see that the change reaches dozens or hundreds of stacks.
By the time anyone notices, the runs are queued or finished: worker capacity is consumed, unrelated changes wait behind them, and a mistaken change has already planned everywhere. Reviewing the combined result afterward is too late to prevent any of that.
Outcome
After Spacelift determines which stacks a PR or push affects, and before it creates any runs, evaluate a policy over the whole set: number of stacks, and which spaces, labels, or environments they belong to.
Above the threshold, no runs start. The PR gets a status check listing the affected stacks, so the author sees the scope of the change before it costs anything.
An authorized user can override and release the runs, recorded in the audit trail.
Follow-on: once released, the same PR check summarizes the combined changes across the proposed runs (total destroys and replaces).
Out of scope
Destroy limits on a single stack. Plan policies already handle this.
Run priority for fan-out changes. Covered by Automatically lower run priority for high fan-out changes.
- Workaround
- Problem
Log in to comment and vote
No comments yet
Be the first to share your thoughts.