Skip to content

Add hidden --local flag to bundle plan and deploy#5680

Open
denik wants to merge 5 commits into
mainfrom
denik/local-only
Open

Add hidden --local flag to bundle plan and deploy#5680
denik wants to merge 5 commits into
mainfrom
denik/local-only

Conversation

@denik

@denik denik commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Adds a hidden --local flag to bundle plan and bundle deploy. When passed, the plan is computed from the local state only — the per-resource remote read is skipped, so the remote state of resources is neither fetched nor considered.

${resources...} references still resolve: .id and other fields come from local state, and a reference that genuinely needs a target's remote state (a remote-only field) fetches that one target on demand. Direct engine only; rejected with an actionable error on terraform.

Tests:

  • acceptance/bundle/local/basicplan --local reports no drift and issues no resource reads, while still resolving a cross-resource reference; local_used telemetry on deploy.
  • acceptance/bundle/local/rejected — terraform rejects the flag.
  • no_drift invariant gains a LOCAL_DIFF matrix that runs every config with and without --local. Five resources are excluded from the --local variant (documented in test.toml): dashboard/genie_space/vector_search_index persist a remote-sourced field in state, and postgres_role/postgres_database hit a state-serialization bug fixed on main but not yet on this branch.

This pull request and its description were written by Isaac.

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

22 files changed
Suggested: @pietern
Also eligible: @janniklasrose, @shreyas-goenka, @andrewnester, @lennartkats-db, @anton-107

/bundle/ - needs approval

9 files changed
Suggested: @pietern
Also eligible: @janniklasrose, @shreyas-goenka, @andrewnester, @lennartkats-db, @anton-107

/cmd/bundle/ - needs approval

5 files changed
Suggested: @pietern
Also eligible: @janniklasrose, @shreyas-goenka, @andrewnester, @lennartkats-db, @anton-107

Any maintainer (@andrewnester, @anton-107, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

@denik denik force-pushed the denik/local-only branch from 6a2e7c1 to ce803e6 Compare June 23, 2026 12:31
@denik denik temporarily deployed to test-trigger-is June 23, 2026 12:31 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 23, 2026 12:31 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 9b4c606

Run: 28077346843

Env 🟨​KNOWN ✅​pass 🙈​skip Time
🟨​ aws linux 1 216 99 2:58
🟨​ aws windows 1 218 97 2:39
🟨​ aws-ucws linux 1 297 18 3:32
🟨​ aws-ucws windows 1 299 16 3:28
🟨​ azure linux 1 216 98 3:12
🟨​ azure windows 1 218 96 2:30
🟨​ azure-ucws linux 1 299 15 3:42
🟨​ azure-ucws windows 1 301 13 3:28
🟨​ gcp linux 1 215 100 3:00
🟨​ gcp windows 1 217 98 2:37
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K

denik added 3 commits June 23, 2026 17:08
When passed, the plan is computed from the local state only: the per-resource
remote read is skipped, so the remote state of resources is neither fetched nor
considered. References that genuinely need a target's remote state (e.g. a
remote-only field) fetch that target on demand, so $resources references still
resolve. Direct engine only; rejected on terraform.

Exercise it in the no_drift invariant via a LOCAL_DIFF matrix.

Co-authored-by: Isaac
When --local resolves a reference that needs a target's remote-only field, it
already fetches that target on demand. Copy those fetched states onto their plan
entries (entry.RemoteState) so the plan shows what was actually read. Done in a
single-threaded pass after the parallel walk: during the walk a target is fetched
from a dependent's goroutine under the target's read lock, where writing its entry
would race with sibling dependents.

Co-authored-by: Isaac
@denik denik force-pushed the denik/local-only branch from ce803e6 to d4eb28b Compare June 23, 2026 15:10
@denik denik temporarily deployed to test-trigger-is June 23, 2026 15:10 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 23, 2026 15:10 — with GitHub Actions Inactive
Add a LOCAL=["", "--local"] matrix to three resource tests (jobs/num_workers,
schemas/update, volumes/change-name) so plan/deploy run both with and without
--local. Deploy issues the same mutating requests either way (only GET reads
differ, which print_requests.py excludes), so output is identical across variants.
--local is excluded on terraform (rejected there) and not applied to `bundle plan
-o json`, whose remote_state would diverge.

Co-authored-by: Isaac
@denik denik temporarily deployed to test-trigger-is June 24, 2026 05:04 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 24, 2026 05:04 — with GitHub Actions Inactive
A --local plan is computed without remote state, so a saved plan can miss
out-of-band drift. Add a top-level local_only field (omitempty, so normal plans
are unchanged) and warn when deploy --plan applies a local-only plan.

Extend local/basic to record the JSON plan, showing local_only: true and the
absence of remote_state.

Co-authored-by: Isaac
@denik denik temporarily deployed to test-trigger-is June 24, 2026 05:28 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 24, 2026 05:28 — with GitHub Actions Inactive
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.

2 participants