fix: scope terraform CI to what actually changed - #117
Open
nboyers wants to merge 1 commit into
Open
Conversation
- Gate the apply job on has_changes. An empty change set produced an empty --filter, so `terragrunt run --all -- apply -auto-approve` was applying all 33 units unfiltered. Also handle a skipped apply in the summary, which would otherwise report every no-op push as a failure. - Watch modules/ in both workflows (trigger paths + git diff scope). 16 units consume the shared modules, so edits there were silently never validated or deployed. - Fix the self-trigger glob: the files are tf-*.yml, not terraform-*.yml, so the pattern matched nothing and workflow edits went untested. Known tradeoff: a shared-module change maps to no single Terragrunt directory, so changed_dirs is empty and the deploy applies everything. Intentional - there is no reliable way to map a module to its consumers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
🔍 Terraform Validation Summaryℹ️ No changes detected in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI: deploy only what changed, and start watching
modules/.applyonhas_changes— an empty change set produced an empty--filter, soterragrunt run --all -- apply -auto-approvewas applying all 33 units unfiltered. Also fixed the summary so a skipped apply isn't reported as a failure.modules/**to both workflows (trigger paths +git diffscope) — 16 units consume the shared modules, so edits there were silently never validated or deployed.tf-*.ymlself-trigger glob — wasterraform-*.yml, matched nothing, so workflow edits went untested.Known tradeoff
A shared-module change maps to no single Terragrunt directory, so
changed_dirsis empty and the deploy applies everything. Intentional — there's no reliable way to map a module to its consumers. Worth noting separately: the EKS addons have no pinnedaddon_version(most_recent = true), so a full apply can bumpcoredns/kube-proxy/vpc-cni. Pinning those would make full applies boring.Verification
YAML parses on both files; discovery logic simulated against real paths:
--filter=aws/us-east-2/eks— unchangedhas_changes=true, validates + applies everything (was: nothing ran)has_changes=false, apply skips cleanlyNot yet exercised in CI — this PR is the first real test.
Out of scope
terraform-*.ymlis still dead intf-deploy.yml(nothing to deploy on a workflow edit). Separately, thehclfmt/terraform fmtchecks still scan the whole tree instead of the changed area — follow-up.🤖 Generated with Claude Code