Skip to content

fix(schema): allow http as a valid terraform backend_type - #2920

Closed
Rémy Macherel (MacherelR) wants to merge 2 commits into
cloudposse:mainfrom
MacherelR:fix/http-backend-type-schema
Closed

Rémy Macherel (MacherelR) wants to merge 2 commits into
cloudposse:mainfrom
MacherelR:fix/http-backend-type-schema

Conversation

@MacherelR

@MacherelR Rémy Macherel (MacherelR) commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

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 #2919

Summary by CodeRabbit

  • New Features

    • Added support for configuring HTTP backends for Terraform and remote state.
    • HTTP backend settings can be provided inline or through included configuration files.
    • Added support for state, locking, and unlock endpoints, request methods, and GitLab token credentials.
  • Documentation

    • Added YAML and JSON configuration examples for HTTP backends.
    • Warned that generated backend files may contain plaintext credentials and should not be committed, logged, or uploaded.

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
@MacherelR
Rémy Macherel (MacherelR) requested a review from a team as a code owner August 11, 2026 12:50
@atmos-pro

atmos-pro Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@github-actions github-actions Bot added the size/m Medium size PR label Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 54e5352e-deba-4afe-b548-f1306c83f50b

📥 Commits

Reviewing files that changed from the base of the PR and between 3ba876f and d477195.

📒 Files selected for processing (2)
  • internal/exec/validate_stacks_test.go
  • website/docs/stacks/_partials/_backend-config.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • website/docs/stacks/_partials/_backend-config.mdx

📝 Walkthrough

Walkthrough

The manifest schemas now accept HTTP Terraform and remote-state backends. Validation tests cover HTTP backend configurations. Documentation describes endpoints, locking, authentication, and generated JSON.

Changes

HTTP backend support

Layer / File(s) Summary
Backend schema contract
pkg/datafetcher/schema/atmos/manifest/1.0.json, tests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
Both schemas allow http for Terraform and remote-state backend types. The backend manifest accepts an !include string or an object with arbitrary properties.
Validation and documentation
internal/exec/validate_stacks_test.go, website/docs/stacks/_partials/_backend-config.mdx
Tests validate standard and remote-state HTTP backend configurations. The documentation covers endpoints, locking, HTTP methods, authentication, and generated JSON.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: osterman

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary change: allowing http as a valid Terraform backend type.
Linked Issues check ✅ Passed The schema updates, fixture synchronization, documentation, and regression test address the requirements in [#2919].
Out of Scope Changes check ✅ Passed All changes support HTTP backend schema validation, documentation, or regression coverage described in [#2919].
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 21c5899 and 3ba876f.

📒 Files selected for processing (4)
  • internal/exec/validate_stacks_test.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • tests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
  • website/docs/stacks/_partials/_backend-config.mdx

Comment thread internal/exec/validate_stacks_test.go Resolved
@osterman

Copy link
Copy Markdown
Member

Thanks for the PR!

Rémy Macherel (@MacherelR) please address the coderabbit review comments.

@codecov

codecov Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.97%. Comparing base (21c5899) to head (d477195).
⚠️ Report is 32 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 82.97% <ø> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 76 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mergify

mergify Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Rémy Macherel (@MacherelR)? 🙏

@mergify mergify Bot added the conflict This PR has conflicts label Aug 19, 2026
Erik Osterman (Cloud Posse) (osterman) added a commit that referenced this pull request Aug 19, 2026
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]>
@osterman

Copy link
Copy Markdown
Member

Closing in favor of #2953, which covers this same fix — adding http to the backend_type/remote_state_backend_type enums and backend_manifest.properties — plus 5 more missing backend types (consul, cos, kubernetes, oss, pg), all 3 hand-maintained schema copies (this PR updated 2 of the 3 — stack-config/1.0.json was still missing http), and several independent schema/validation bug classes found via a follow-up field test on the same root cause.

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 _backend-config.mdx section and credentials warning) into #2953 so that contribution isn't lost: 66f66a45d5.

auto-merge was automatically disabled August 19, 2026 04:16

Pull request was closed

@atmos-pro

atmos-pro Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

@mergify mergify Bot removed the conflict This PR has conflicts label Aug 19, 2026
Michael Pursifull (arcaven) pushed a commit to arcaven/atmos that referenced this pull request Aug 19, 2026
… 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]>

This branch was previously deployed

1 inactive deployment
screengrabs — d477195e Deployed Aug 18, 2026 by MacherelR via build #1350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A minor, backward compatible change size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing http as backend type

2 participants