Skip to content

ci: validate bundled infra/ Terraform with fmt + validate (#54) - #55

Merged
jkas2016 merged 1 commit into
mainfrom
ci/54-terraform-validate
Aug 7, 2026
Merged

ci: validate bundled infra/ Terraform with fmt + validate (#54)#55
jkas2016 merged 1 commit into
mainfrom
ci/54-terraform-validate

Conversation

@jkas2016

@jkas2016 jkas2016 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a credential-free terraform-validate CI job so the bundled infra/ HCL is verified like the JS is.

infra/ ships inside the npm package (scripts/copy-templates.mjsdist/templates/infra/), and hostdoc provision runs that HCL on the user's machine — so it is a released artifact. CI previously ran only build→typecheck→test, leaving the HCL unverified: a typo or dangling reference would ship and break every user's provision.

Why this doesn't break the "CI never touches live AWS" rule

command AWS creds AWS calls
terraform fmt -check no none
terraform init -backend=false + validate no none (provider download only)
plan / apply yes yes — still local-only, not added

Changes

  • .github/workflows/ci.yml — new terraform-validate job: fmt -check -diffinit -backend=falsevalidate.
  • CLAUDE.md — "no AWS creds and no Terraform" → "no AWS creds and no plan/apply", so the allowance is explicit while the live-AWS ban stays.

Verification

  • Green on this branch: terraform-validate passes in 17s with no credentials (run 31141651394). Fast enough that provider caching isn't worth the complexity yet.
  • Negative check run in CI, not just locally: a temporary commit adding no_such_arg = true to a bucket resource made terraform-validate fail while build-test still passed — confirming the job blocks bad HCL and that the JS suite never would have (run 31141702581). That commit was dropped from the branch.
  • Applied to PR feat: hostdoc insight <code> — CloudFront visit stats (#43, cloudfront slice) #53 (which adds 92 lines of new Terraform): fmt + validate both pass — that PR's self-declared "CI structurally can't cover this" gap is now machine-checked.

Non-goals

  • No plan/apply and no live AWS contact, in CI or anywhere else automated.
  • No action-version bump for the existing build-test job (the Node 20 deprecation warning on actions/checkout@v4 is pre-existing and out of scope).

Closes #54

🤖 Generated with Claude Code

https://claude.ai/code/session_01JgrcpuSKPkvUE4xYity9ua

infra/ ships inside the npm package (dist/templates/infra/), so its HCL is a
released artifact just like the JS — yet CI only ran build/typecheck/test,
leaving the HCL unverified. A typo or dangling reference would break every
user's `hostdoc provision`.

`fmt -check` and `validate` (after `init -backend=false`) need no AWS
credentials and make no AWS calls — only a provider download — so this widens
artifact coverage to HCL without breaking the "CI never touches live AWS" rule.
`plan`/`apply` remain local-only.

Verified on a clean `git archive` copy of infra/: fmt + validate pass with no
credentials; an unsupported argument fails validate (exit 1) and misaligned HCL
fails fmt -check (exit 3).

Closes #54

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JgrcpuSKPkvUE4xYity9ua
@jkas2016
jkas2016 merged commit 65ff026 into main Aug 7, 2026
7 checks passed
@jkas2016
jkas2016 deleted the ci/54-terraform-validate branch August 7, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] CI에서 번들되는 infra/ Terraform을 fmt/validate로 검증 (HCL 배포물 사각지대)

1 participant