feat(terraform): let validate and test run on a configuration in a subdirectory - #183
Merged
Merged
Conversation
…check Both jobs ran at the repository root, so a repository keeping its Terraform in a subdirectory got a green run over no configuration. working-directory defaults to "." and changes nothing for existing callers. terraform fmt without -check rewrites the runner's checkout and cannot fail. fmt-check adds -check -diff -recursive; it is off by default because every current caller pins @main, and turning it on for them unasked could fail repositories that have never been held to it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GoGGkGh5RLytzKMJ3PqLYa
terraform test resolves -test-directory against the configuration it runs in, which was always the repository root. working-directory defaults to "." and changes nothing for existing callers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GoGGkGh5RLytzKMJ3PqLYa
verbose is a boolean input, and comparing it with the string 'true' coerces both sides to numbers — 1 against NaN — so the flag was never passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GoGGkGh5RLytzKMJ3PqLYa
Contributor
Author
|
First caller run, pinned to this branch's head ( With
The 🤖 Generated with Claude Code |
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.
call-validate-terraformandcall-terraform-testalways run at the repository root. A repository that keeps its Terraform in a subdirectory — stuttgart-things/schmetterpause has it interraform/, beside the application — gets green jobs over no configuration at all. And the validate job runsterraform fmtwithout-check, so it rewrites the runner's checkout and cannot fail on formatting anywhere.Changes
call-validate-terraformworking-directory(default".") — both the validate and the tflint step run there.fmt-check(defaultfalse) — adds-check -diff -recursivetoterraform fmt.call-terraform-testworking-directory(default".") —-test-directoryis resolved against it, asterraform testdoes anyway.verboseis a boolean, andinputs.verbose == 'true'coerces both sides to numbers (1 against NaN), so-verbosewas never passed.Existing callers
Unchanged. Every current caller pins
@main, which is why both new inputs default to the old behaviour:vault-base-setup— validate and testvsphere-vm,proxmox-vm— validatefmt-checkis opt-in for that reason: switching it on for them unasked could fail a repository that has never been held tofmt. Worth a follow-up per repository once each is known to be formatted.Verification
pre-commit runover both files passes, includingcheck-github-workflows.actionlintreports nothing on the changed lines. It does report the existingrequired: trueinputs that also carry adefault, which are unused for that reason — left as they are, since changingrequiredis a separate decision.terraform fmt -check -recursive,validateandtest(7/7) pass inschmetterpause/terraform, andtflint --recursivev0.55.1 reports nothing there.Not verified: no workflow run has used the new inputs yet — draft until one has. The planned first caller is stuttgart-things/schmetterpause#207:
🤖 Generated with Claude Code
https://claude.ai/code/session_01GoGGkGh5RLytzKMJ3PqLYa