Repository navigation
fix(schema): allow http as a valid terraform backend_type - #2920
Rémy Macherel (MacherelR) wants to merge 2 commits into
Conversation
The atmos-manifest JSON Schema's backend_type/remote_state_backend_type enum and backend_manifest properties hardcoded 8 backend types (local, s3, remote, vault, static, azurerm, gcs, cloud) and rejected Terraform/ OpenTofu's generic `http` backend, used e.g. for GitLab-managed Terraform state. Since schema validation of imported/mixin files was recently fixed to actually run, any manifest using `backend_type: http` now fails `atmos describe stacks` (and anything that calls it, e.g. `terraform plan/apply`) outright, even though backend generation itself (generateComponentBackendConfig) has always handled arbitrary backend types generically. Add "http" to both enums and to backend_manifest.properties, mirroring the existing entries. Also update the test fixture copy of the schema to keep it in sync, document the HTTP backend in the backend-config docs partial, and add a regression test proving backend_type: http now passes validation with the default embedded schema. closes cloudposse#2919
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe manifest schemas now accept HTTP Terraform and remote-state backends. Validation tests cover HTTP backend configurations. Documentation describes endpoints, locking, authentication, and generated JSON. ChangesHTTP backend support
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/exec/validate_stacks_test.go`:
- Around line 251-260: The manifest test case around the existing HTTP backend
configuration only covers components. Add a table-driven scenario that
configures and validates remote-state HTTP settings using
remote_state_backend_type: http and remote_state_backend.http, including
representative address and lock/unlock fields, while preserving the existing
backend case and expected validation behavior.
In `@website/docs/stacks/_partials/_backend-config.mdx`:
- Around line 295-308: Update the Generated File example in the backend
configuration documentation to explicitly warn that backend.tf.json contains
credentials, including the expanded CI_JOB_TOKEN password, and must not be
committed, logged, or uploaded as an artifact.
- Around line 291-292: Update the backend configuration credentials to read
CI_JOB_TOKEN from the process environment using the supported env lookup syntax,
or first map it through the component env section with !env and reference that
mapping. Preserve the existing GitLab username and password configuration.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 071d042f-f31c-4f4f-95ec-b8daf2ed3537
📒 Files selected for processing (4)
internal/exec/validate_stacks_test.gopkg/datafetcher/schema/atmos/manifest/1.0.jsontests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.jsonwebsite/docs/stacks/_partials/_backend-config.mdx
|
Thanks for the PR! Rémy Macherel (@MacherelR) please address the coderabbit review comments. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2920 +/- ##
==========================================
+ Coverage 82.83% 82.97% +0.13%
==========================================
Files 1866 1879 +13
Lines 181277 182749 +1472
==========================================
+ Hits 150160 151629 +1469
+ Misses 23313 23299 -14
- Partials 7804 7821 +17
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
💥 This pull request now has conflicts. Could you fix it Rémy Macherel (@MacherelR)? 🙏 |
Adds an HTTP Backend section to the backend-config partial, folded in from @MacherelR's PR #2920 (which this PR supersedes with a broader fix covering http plus 5 other missing backend types across all 3 schema copies). Credits the original contribution rather than losing it when superseding the PR. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Closing in favor of #2953, which covers this same fix — adding Thanks for finding and fixing this, Rémy Macherel (@MacherelR) — the report and the fix were spot on. I've folded your HTTP-backend documentation (the |
Pull request was closed
… schema rejected (cloudposse#2953) * fix(schemas): accept documented backend types and other fields the manifest schema silently rejected Fixes cloudposse#2919: the stack-manifest JSON Schema hardcoded an 8-value backend_type enum, silently rejecting consul/cos/http/kubernetes/oss/pg even though they're documented as supported. A field test over the fix found the same bug class elsewhere (overrides.hooks/generate/secrets/auth/retry/required_*, component- level retry, required_version/required_providers, source.ttl, container_runtime.provider: auto), one field the schema was too permissive for (workflow_step.output.mode: raw), a root-schema oneOf bug that made workflows: and vars:/settings: mutually exclusive, and a silent (non-erroring) backend_type/backend key-mismatch bug. All fixed together, with regression tests at both the schema-unit and CLI level. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(ci): exclude flaky LSP-spec and AWS STS link-check hosts CI's Check Markdown Links job failed on two connection resets: microsoft.github.io/language-server-protocol and the AWS STS GetFederationToken API reference. Both return 200 outside CI; excluded per the repo's existing precedent for CI-runner connection flakiness. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(schemas): address CodeRabbit review feedback on PR cloudposse#2953 - Extract checkTerraformBackendTypeMatch helper to keep processTerraformBackend within the 60-line function limit. - Add "" to workflow_step.output.mode's schema enum (Go's validateParallelOutput already accepted it as equivalent to unset). - Isolate the "rejects unrecognized backend key" test case so it fails only for the backend key, not the backend_type enum. - Drop the redundant "website" schema-copy entry from this PR's new test tables (byte-identical to "embedded" by design, so it never caught drift; correct the fix-log's copy count to match). - Fix an MD018 markdownlint violation in the fix-log (issue reference starting a line). Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(security): bump github.com/moby/go-archive to v0.3.0 Remediates GHSA (Dependabot alert cloudposse#277): a crafted tar archive could write outside the extraction directory. Indirect dependency only; also pulls in moby/sys/sequential v0.7.0 and moby/sys/user v0.4.1 via go mod tidy. Minor-version bump, within dependabot.yml policy. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(schemas): fix backend_type/backend mismatch in plan-diff fixture The plan-diff CLI test fixture declared backend_type: local but had an s3 backend block, which this PR's new backend_type/backend key-mismatch check now correctly rejects instead of silently falling back to an empty backend. Also sharpens the fix-log's follow-up notes and documents the CI-generated (not checked-in) website schema path per CodeRabbit review feedback on PR cloudposse#2953. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(stacks): document the HTTP backend Adds an HTTP Backend section to the backend-config partial, folded in from @MacherelR's PR cloudposse#2920 (which this PR supersedes with a broader fix covering http plus 5 other missing backend types across all 3 schema copies). Credits the original contribution rather than losing it when superseding the PR. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(stacks): expand HTTP backend credential persistence warning CodeRabbit flagged that the warning only mentioned backend.tf.json, but the same plaintext credentials also persist in .terraform/terraform.tfstate and saved plan files. Recommend TF_HTTP_USERNAME/TF_HTTP_PASSWORD env vars instead of embedding credentials in the backend config. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
The atmos-manifest JSON Schema's backend_type/remote_state_backend_type enum and backend_manifest properties hardcoded 8 backend types (local, s3, remote, vault, static, azurerm, gcs, cloud) and rejected Terraform/ OpenTofu's generic
httpbackend, used e.g. for GitLab-managed Terraform state. Since schema validation of imported/mixin files was recently fixed to actually run, any manifest usingbackend_type: httpnow failsatmos describe stacks(and anything that calls it, e.g.terraform plan/apply) outright, even though backend generation itself (generateComponentBackendConfig) has always handled arbitrary backend types generically.Add "http" to both enums and to backend_manifest.properties, mirroring the existing entries. Also update the test fixture copy of the schema to keep it in sync, document the HTTP backend in the backend-config docs partial, and add a regression test proving backend_type: http now passes validation with the default embedded schema.
closes #2919
Summary by CodeRabbit
New Features
Documentation