Add --endpoint-url flag to target externally-managed emulators - #419
Draft
peter-smith-phd wants to merge 4 commits into
Draft
Add --endpoint-url flag to target externally-managed emulators#419peter-smith-phd wants to merge 4 commits into
peter-smith-phd wants to merge 4 commits into
Conversation
Proposes letting aws/az/terraform/cdk/sam/snapshot/reset/status target an externally-managed emulator (docker compose, host mode, remote) via --endpoint-url/LSTK_ENDPOINT_URL/AWS_ENDPOINT_URL, bypassing local Docker discovery in favor of an HTTP health-based reachability and type probe. Co-Authored-By: Claude <noreply@anthropic.com>
Lets aws/az/terraform/cdk/sam/snapshot/reset/status target an emulator lstk didn't start (docker compose, host-network mode, a remote machine) via --endpoint-url/LSTK_ENDPOINT_URL/AWS_ENDPOINT_URL, bypassing local Docker discovery in favor of an HTTP-based reachability and type probe. BREAKING: terraform/cdk/sam previously required a locally Docker-discovered AWS container even when AWS_ENDPOINT_URL was set (it only relabeled the generated endpoint value). AWS_ENDPOINT_URL alone now also skips that Docker discovery, consistent with the other two sources. Co-Authored-By: Claude <noreply@anthropic.com>
Picks up #399 (Podman/Rancher Desktop runtime detection), which added Flavor() and InspectBrief() to the Runtime interface. Implements both on the externalRuntime stub added by this branch: Flavor reports FlavorUnknown (no real daemon behind an externally-managed emulator), InspectBrief mirrors IsRunning's exact-name-match logic. Co-Authored-By: Claude <noreply@anthropic.com>
…ecycle commands Preserves the resolved scheme end-to-end for --endpoint-url targets (needed for LocalStack's cloud-hosted ephemeral instances) and fixes three bugs: status omitted resources for external targets, start silently accepted and ignored --endpoint-url, and logs/stop/restart/volume/start only rejected an explicit flag while silently proceeding against the local emulator when LSTK_ENDPOINT_URL/AWS_ENDPOINT_URL was set ambiently. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
--endpoint-url <url>flag (plusLSTK_ENDPOINT_URL/AWS_ENDPOINT_URLenv vars) soaws,az,terraform/tf,cdk,sam,snapshot save/load/remove/list s3://...,reset, andstatuscan target an emulator lstk didn't start — docker compose, host-network mode, CI, or a remote machine — instead of discovering one via local Docker./_localstack/health(falling back to/_localstack/infofor Azure); there's no manual override — an inconclusive result is a hard failure.logs/stop/restart/volumereject an explicit--endpoint-url(no remote equivalent, and silently ignoring it risks acting on the wrong local target);snapshot show/baresnapshot listsilently ignore it (platform-only, no emulator involved either way).--endpoint-urlis recognized only when it precedes the subcommand name for the fiveDisableFlagParsingproxy commands, matching--json's existing treatment — required because theawsCLI has its own native--endpoint-urlflag that must still reach it untouched when placed afteraws.terraform/cdk/sampreviously required a locally Docker-discovered AWS container even whenAWS_ENDPOINT_URLwas set (it only relabeled the generated endpoint value).AWS_ENDPOINT_URLalone now also skips that Docker discovery, consistent with--endpoint-url/LSTK_ENDPOINT_URL.Full design/spec:
openspec/changes/add-endpoint-url-flag/.Review
Advised. This is a large, cross-cutting change (new package, 12+ command files rewired, one breaking-change behavior) with several non-obvious design calls — the pre-command-only flag placement rule, the
runtime.NewExternalRuntimestub used to reuse existing Docker-shaped discovery code, and the reject-vs-silently-ignore split for commands that don't support the flag. Worth a careful pass before merging.One caveat: the AWS-vs-Snowflake detection heuristic (inspecting the
/_localstack/healthservicesmap) was confirmed against a real AWS community image but not against Snowflake, which requires a licensed emulator I didn't have access to — see design.md's Open Questions.Test plan
go build ./...,go vet ./..., full unit suite (1194 passed)internal/endpoint/target_test.go(precedence, URL validation, health/type probe classification),internal/runtime/external_test.gotest/integration/endpoint_url_test.go(Docker-bypass, aws-CLI flag-collision fix, reject/ignore split, wrong-type detection,AWS_ENDPOINT_URLbreaking-change bypass)golangci-lint(newer local version than pinned; only findings are in an untouched file) andgovulncheckcleanCloses DEVX-1025
Co-Authored-By: Claude noreply@anthropic.com