Skip to content

Run LocalStack with lstk in both templates (1.0.0) - #7

Merged
bartsdev merged 4 commits into
mainfrom
migrate-to-lstk
Nov 23, 2026
Merged

bartsdev merged 4 commits into
mainfrom
migrate-to-lstk

Conversation

@HarshCasper

@HarshCasper HarshCasper commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Part of DEVX-1046. Depends on localstack/devcontainer-feature#9.

Both Templates still run the legacy localstack CLI with awslocal, tflocal, cdklocal and samlocal, and point at localstack-cli:latest of the Feature. A user flagged the deprecated tflocal in the community Slack. This PR moves both Templates to lstk and bumps them to 1.0.0.

Docker-in-Docker (localstack-dind)

  • lstk starts LocalStack on every container start (postStartCommand), after waiting for the inner Docker daemon. lstk start returns once LocalStack is ready, so no localstack wait.
  • Configuration lives in .devcontainer/lstk/config.toml (image tag, /data state mount, LocalStack variables as an [env.devcontainer] profile). ~/.config/lstk/config.toml links to it, so every lstk command in the container uses it, from any folder.
  • lstk setup aws writes the localstack profile and the Template sets AWS_PROFILE=localstack. Plain aws and the SDKs hit LocalStack.
  • No more AWS_ENDPOINT_URL in remoteEnv. lstk start refuses to run when it is set (lstk reads it as "target an external emulator").
  • State moves from a host bind mount to the localstack-data-${devcontainerId} volume. The old setup failed when the host folder did not exist. The volumePath option is gone.
  • Dropped the template's own dind-var-lib-docker mount. The docker-in-docker Feature (now :4) already mounts a per-container volume at the same path, and the template's fixed volume name was shared by every dev container built from it.
  • Without an auth token the container still comes up, and post-start.sh tells the user to set the token or run lstk login.

Docker-outside-of-Docker (localstack-dood)

  • LocalStack stays a Compose service. The app container gets LSTK_ENDPOINT_URL, so lstk status, lstk aws, lstk terraform and the snapshot commands talk to it. lstk start and lstk stop refuse to run, which replaces the old warning in the README.
  • Set LAMBDA_DOCKER_NETWORK and gave the network a fixed name, so Lambda containers join the shared network whatever the Compose project is called. The smoke test invokes a Lambda function to cover this.
  • The auth token goes through Compose environment from the host. .env only carries LocalStack variables now, not client settings.
  • post-start.sh waits for LocalStack and prints lstk status.
  • Dropped the obsolete Compose version key.

Both

  • Removed awslocal, cdklocal, pulumilocal, samlocal, tflocal and usePro. Both now add the AWS CLI Feature, needed by lstk aws and the profile. NOTES list the Feature to add for lstk terraform, lstk cdk and lstk sam.
  • Removed LOCALSTACK_API_KEY and ACTIVATE_PRO.
  • Fixed the descripiton typo on most options. VS Code showed them with no description.
  • imageVariant: noble (default), jammy, resolute, bookworm. Dropped focal (EOL) and bullseye. version proposals are latest, stable, 2026.10.
  • Pinned the Feature to localstack-cli:1 instead of :latest.

CI

  • Removed continue-on-error: true. It kept CI green while the tests failed.
  • Pull requests test the templates they touch. Pushes to main and manual runs test both. Changes to .github or test/test-utils test both.
  • Empty option defaults are allowed, so loadPods no longer needs a " " default.
  • Shared cleanup.sh stops the Compose services, removes containers LocalStack started on the network (Lambda), then the network. Before, a leftover Lambda container blocked the network removal.
  • LOCAL_FEATURE_DIR lets the scripts test against a local Feature checkout. I used it for the local runs below.
  • New optional feature-ref input on the workflow and both actions. It checks out localstack/devcontainer-feature at that ref and tests against it, so a Template change can be tested before the Feature it needs is released.
  • New scenario tests, end to end against a real LocalStack:
    • DinD: smoke (status, lstk aws, profile, Lambda invoke, lstk stop), Terraform + CDK + SAM through lstk on jammy, persistence with a pinned 2026.10 image and lstk restart on bookworm, IAM enforcement + region + trace logging, Cloud Pod auto-load on resolute, startup: false.
    • DooD: smoke (DNS, lstk start refused, lstk aws, profile, Lambda over the shared network), custom host + IAM + region, persistence with a pinned image on jammy, lstk terraform over the endpoint + Cloud Pod auto-load + trace logging on bookworm.
    • The Cloud Pod scenarios save a pod, restart LocalStack, check it auto-loads, then delete the pod.

Testing

Run locally on arm64 (OrbStack) with Dev Container CLI 0.91.0, LOCAL_FEATURE_DIR pointing at the Feature PR, and the DooD host ports removed (a LocalStack was already bound to 4566 on my machine):

Template Run Result
DinD smoke (test.sh) 11/11 checks pass
DinD iac_tools_on_jammy pass: lstk terraform apply/destroy, lstk cdk bootstrap/deploy, lstk sam deploy + invoke
DinD iam_region_and_debug pass
DinD load_pod pass
DinD no_startup pass
DinD persistence_pinned_version_on_bookworm pass
DooD smoke (test.sh) 11/11 checks pass
DooD custom_host_iam_and_region pass
DooD persistence_pinned_version_on_jammy pass
DooD terraform_pod_and_debug_on_bookworm pass

I also checked the DinD lifecycle by hand. Stopping and starting the dev container brings LocalStack back. A rebuild on the same volumes reuses the image and starts it. A rebuild with no LOCALSTACK_AUTH_TOKEN still comes up, and prints the hint instead of failing devcontainer up.

Merge order

The last commit (ci: TEMP ...) points this PR's CI at the migrate-to-lstk branch of the Feature repo, so the full suite runs on GitHub's amd64 runners before the Feature is released. It has to be reverted before merge.

  1. Merge Install lstk instead of the legacy localstack CLI (1.0.0) devcontainer-feature#9 and run its release workflow, so localstack-cli:1 exists on GHCR.
  2. Revert the ci: TEMP commit here and re-run CI against the published Feature.
  3. Merge and run the release workflow to publish the Templates.

CI status

CI is red because the repo secret LOCALSTACK_AUTH_TOKEN (last set July 2024) is no longer valid. With the ci: TEMP commit, the runs get as far as the license check on GitHub's amd64 runners. The Feature installs from its branch, docker-in-docker starts, and the image pulls. Then lstk start stops with:

Error: License validation failed for localstack-pro:2026.10.8: invalid token format, missing license assignment, or missing subscription

A repo admin needs to set LOCALSTACK_AUTH_TOKEN to a valid CI auth token. Then re-run this workflow.

HarshCasper and others added 4 commits November 23, 2026 17:26
Bump localstack-dind and localstack-dood to 1.0.0 and replace the legacy
localstack CLI and the awslocal, cdklocal, pulumilocal, samlocal and
tflocal options with lstk from localstack-cli:1.

DinD: lstk starts LocalStack on every container start, reads
.devcontainer/lstk/config.toml, keeps state in a Docker volume and
writes a localstack AWS profile. AWS_ENDPOINT_URL is no longer set,
since lstk start refuses to run with it.

DooD: lstk targets the compose service through LSTK_ENDPOINT_URL.
Lambda containers join the shared network via LAMBDA_DOCKER_NETWORK.

Fix the option description typo, drop usePro and LOCALSTACK_API_KEY,
add end-to-end scenario tests and stop CI from ignoring failures.
Add a feature-ref input to the test workflow and both test actions. When
set, CI checks out localstack/devcontainer-feature at that ref and builds
the Templates with it through LOCAL_FEATURE_DIR.
Startup failures of the DooD LocalStack service, such as a rejected auth
token, only surfaced as an unreachable endpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bartsdev
bartsdev merged commit a332bf5 into main Nov 23, 2026
18 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants