Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
pull-requests: write
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: "Publish Features"
uses: devcontainers/action@v1
Expand Down
20 changes: 4 additions & 16 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ on:
jobs:
test-autogenerated:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
features:
- localstack-cli
baseImage:
- debian:latest
- ubuntu:latest
- mcr.microsoft.com/devcontainers/base:ubuntu
- mcr.microsoft.com/devcontainers/base:alpine
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli
Expand All @@ -39,28 +40,15 @@ jobs:

test-scenarios:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
features:
- localstack-cli
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

- name: "Generating tests for '${{ matrix.features }}' scenarios"
run: devcontainer features test -f ${{ matrix.features }} --skip-autogenerated --skip-duplicated .

test-global:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3

- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

- name: "Testing global scenarios"
run: devcontainer features test --global-scenarios-only .
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: "Validate devcontainer-feature.json files"
uses: devcontainers/action@v1
Expand Down
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,44 @@ Features are designed to install atop a wide-range of base container images (thi
> This repo currently a work in progress which might introduce breaking changes without notification.

## List of features
- [LocalStack](https://docs.localstack.cloud/getting-started/): install the LocalStack CLI tool and any of the related _Local™_ tools for:
- AWS CLI
- AWS CDK
- AWS SAM CLI
- Terraform
- Pulumi
- [LocalStack CLI](src/localstack-cli): installs [`lstk`](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/), the LocalStack CLI.
`lstk` starts and manages LocalStack and runs the AWS CLI, Terraform, AWS CDK and AWS SAM against it, replacing `awslocal`, `tflocal`, `cdklocal` and `samlocal`.
It can also install `pulumilocal` for Pulumi.

Version 1.x of the Feature installs `lstk`. Version 0.x installed the legacy Python `localstack` CLI and is still available as `localstack-cli:0`.

## Usage
To reference a feature from this repository, add the desired features to a `devcontainer.json`.
Each feature has a `README.md` that shows how to reference the feature and which options are available for that feature.

The example below installs the LocalStack CLI declared in the `./src` directory of this repository.

See the relevant feature's README for supported options.
The example below installs `lstk` together with Docker-in-Docker and the AWS CLI, which `lstk` needs to start LocalStack and run `lstk aws`.

```json
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"image": "mcr.microsoft.com/devcontainers/base:noble",
"features": {
"ghcr.io/localstack/devcontainer-feature/localstack-cli": {}
"ghcr.io/devcontainers/features/docker-in-docker:4": {},
"ghcr.io/devcontainers/features/aws-cli:1": {},
"ghcr.io/localstack/devcontainer-feature/localstack-cli:1": {}
},
"remoteEnv": {
"LOCALSTACK_AUTH_TOKEN": "${localEnv:LOCALSTACK_AUTH_TOKEN}"
}
}
```

For a ready-made setup that also starts LocalStack, use the [LocalStack DevContainer Templates](https://github.com/localstack/devcontainer-template).

## Testing

The tests use the [Dev Container CLI](https://github.com/devcontainers/cli):

```bash
npm install -g @devcontainers/cli
devcontainer features test -f localstack-cli --skip-autogenerated . # scenarios in test/localstack-cli/scenarios.json
devcontainer features test -f localstack-cli --skip-scenarios -i debian:latest .
```

## Repo and Feature Structure
Similar to the [`devcontainers/features`](https://github.com/devcontainers/features) repo, this repository has a `src` folder.
Each feature has its own sub-folder, containing at least a `devcontainer-feature.json` and an entrypoint script `install.sh`.
Expand Down
54 changes: 46 additions & 8 deletions src/localstack-cli/NOTES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
Available versions of the Localstack CLI can be found here: https://pypi.org/project/localstack/.
This Feature installs [`lstk`](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/), the LocalStack CLI, from its [GitHub releases](https://github.com/localstack/lstk/releases).
The download is checked against the release checksums.
Bash, zsh and fish completions and man pages are installed too.

## OS Support
## Using lstk in the container

This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`lstk` needs a Docker daemon to start LocalStack.
Add the `docker-in-docker` or `docker-outside-of-docker` Feature, or use one of the [LocalStack DevContainer Templates](https://github.com/localstack/devcontainer-template).

`bash` is required to execute the `install.sh` script.
Pass your [auth token](https://docs.localstack.cloud/aws/getting-started/auth-token/) from the host:

`cdklocal` option requires `npm` to be installed which is not handled by this feature.
All other tools are installed by `pipx` which is installed via package manager or the Python installation. The latter can be combined with the Python feature.
```json
"remoteEnv": {
"LOCALSTACK_AUTH_TOKEN": "${localEnv:LOCALSTACK_AUTH_TOKEN}"
}
```

> [!NOTE]
> None of the wrapped tool(s) (ie Terraform, Pulumi or AWS CLI...etc), are handled by this feature, to install the underlying tool(s) please use the respective feature from the [DevContainer Feature Community Index](https://containers.dev/features).
You can also run `lstk login` in a container terminal.

`lstk start` refuses to run when `AWS_ENDPOINT_URL` or `LSTK_ENDPOINT_URL` is set, because those variables tell `lstk` to target an emulator it does not manage.
Set them only when LocalStack runs outside the container, for example as a Docker Compose service.

## Tool integrations

`lstk` replaces the `awslocal`, `tflocal`, `cdklocal` and `samlocal` wrapper scripts.
It does not install the underlying tools. Add the matching Feature for each one you use:

| Command | Replaces | Feature for the underlying tool |
| --- | --- | --- |
| `lstk aws` | `awslocal` | `ghcr.io/devcontainers/features/aws-cli:1` |
| `lstk terraform`, `lstk tf` | `tflocal` | `ghcr.io/devcontainers/features/terraform:1` |
| `lstk cdk` | `cdklocal` | `ghcr.io/devcontainers-extra/features/aws-cdk:2` (CDK 2.177.0 or newer) |
| `lstk sam` | `samlocal` | `ghcr.io/customink/codespaces-features/sam-cli:1` (SAM CLI 1.95.0 or newer) |

There is no `lstk` command for Pulumi.
Set `pulumilocal: true` to install the [`pulumi-local`](https://github.com/localstack/pulumi-local) wrapper with `pipx`, and add `ghcr.io/devcontainers-extra/features/pulumi:1` for Pulumi itself.
This is the only option that pulls in Python.

## Migrating from 0.x

Version 1.0.0 of this Feature drops the legacy Python `localstack` CLI and the `awslocal`, `cdklocal`, `samlocal`, `tflocal` and `installUsingPython` options.
The `version` option now selects an `lstk` release.
See the [lstk migration guide](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/migration/) for the command mapping.

If you still need the legacy CLI, pin the old major version: `ghcr.io/localstack/devcontainer-feature/localstack-cli:0`.

## OS support

The Feature works on Debian, Ubuntu and Alpine based images on `amd64` and `arm64`.
It installs `curl`, `tar`, `gzip` and `ca-certificates` when they are missing, and `pipx` when `pulumilocal` is enabled.
`bash` is required to run `install.sh`.
70 changes: 52 additions & 18 deletions src/localstack-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,75 @@

# LocalStack CLI (localstack-cli)
# LocalStack CLI (lstk) (localstack-cli)

Installs the Localstack CLI along with needed dependencies and popular "local" tools.
Installs lstk, the LocalStack CLI. lstk starts and manages LocalStack and runs the AWS CLI, Terraform, AWS CDK and AWS SAM against it.

## Example Usage

```json
"features": {
"ghcr.io/localstack/devcontainer-feature/localstack-cli:0": {}
"ghcr.io/localstack/devcontainer-feature/localstack-cli:1": {}
}
```

## Options

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Select or enter a Localstack CLI version. | string | latest |
| awslocal | Install awscli-local, a thin wrapper of AWS CLI for LocalStack. | boolean | false |
| cdklocal | Install aws-cdk-local, a thin wrapper of AWS CDK for LocalStack. | boolean | false |
| pulumilocal | Install pulumi-local, a thin wrapper of Pulumi for LocalStack. | boolean | false |
| samlocal | Install aws-sam-cli-local, a thin wrapper of AWS SAM CLI for LocalStack. | boolean | false |
| tflocal | Install terraform-local, a thin wrapper of Terraform for LocalStack. | boolean | false |
| installUsingPython | Install LocalStack CLI using Python instead of pipx | boolean | false |
| version | Select or enter an lstk version (see https://github.com/localstack/lstk/releases). | string | latest |
| pulumilocal | Install pulumi-local (pulumilocal), the LocalStack wrapper for Pulumi. lstk has no Pulumi command. Installs pipx and Python. | boolean | false |

Available versions of the Localstack CLI can be found here: https://pypi.org/project/localstack/.
This Feature installs [`lstk`](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/), the LocalStack CLI, from its [GitHub releases](https://github.com/localstack/lstk/releases).
The download is checked against the release checksums.
Bash, zsh and fish completions and man pages are installed too.

## OS Support
## Using lstk in the container

This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`lstk` needs a Docker daemon to start LocalStack.
Add the `docker-in-docker` or `docker-outside-of-docker` Feature, or use one of the [LocalStack DevContainer Templates](https://github.com/localstack/devcontainer-template).

`bash` is required to execute the `install.sh` script.
Pass your [auth token](https://docs.localstack.cloud/aws/getting-started/auth-token/) from the host:

`cdklocal` option requires `npm` to be installed which is not handled by this feature.
All other tools are installed by `pipx` which is installed via package manager or the Python installation. The latter can be combined with the Python feature.
```json
"remoteEnv": {
"LOCALSTACK_AUTH_TOKEN": "${localEnv:LOCALSTACK_AUTH_TOKEN}"
}
```

You can also run `lstk login` in a container terminal.

`lstk start` refuses to run when `AWS_ENDPOINT_URL` or `LSTK_ENDPOINT_URL` is set, because those variables tell `lstk` to target an emulator it does not manage.
Set them only when LocalStack runs outside the container, for example as a Docker Compose service.

## Tool integrations

`lstk` replaces the `awslocal`, `tflocal`, `cdklocal` and `samlocal` wrapper scripts.
It does not install the underlying tools. Add the matching Feature for each one you use:

| Command | Replaces | Feature for the underlying tool |
| --- | --- | --- |
| `lstk aws` | `awslocal` | `ghcr.io/devcontainers/features/aws-cli:1` |
| `lstk terraform`, `lstk tf` | `tflocal` | `ghcr.io/devcontainers/features/terraform:1` |
| `lstk cdk` | `cdklocal` | `ghcr.io/devcontainers-extra/features/aws-cdk:2` (CDK 2.177.0 or newer) |
| `lstk sam` | `samlocal` | `ghcr.io/customink/codespaces-features/sam-cli:1` (SAM CLI 1.95.0 or newer) |

There is no `lstk` command for Pulumi.
Set `pulumilocal: true` to install the [`pulumi-local`](https://github.com/localstack/pulumi-local) wrapper with `pipx`, and add `ghcr.io/devcontainers-extra/features/pulumi:1` for Pulumi itself.
This is the only option that pulls in Python.

## Migrating from 0.x

Version 1.0.0 of this Feature drops the legacy Python `localstack` CLI and the `awslocal`, `cdklocal`, `samlocal`, `tflocal` and `installUsingPython` options.
The `version` option now selects an `lstk` release.
See the [lstk migration guide](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/migration/) for the command mapping.

If you still need the legacy CLI, pin the old major version: `ghcr.io/localstack/devcontainer-feature/localstack-cli:0`.

## OS support

The Feature works on Debian, Ubuntu and Alpine based images on `amd64` and `arm64`.
It installs `curl`, `tar`, `gzip` and `ca-certificates` when they are missing, and `pipx` when `pulumilocal` is enabled.
`bash` is required to run `install.sh`.

> [!NOTE]
> None of the wrapped tool(s) (ie Terraform, Pulumi or AWS CLI...etc), are handled by this feature, to install the underlying tool(s) please use the respective feature from the [DevContainer Feature Community Index](https://containers.dev/features).

---

Expand Down
63 changes: 14 additions & 49 deletions src/localstack-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,33 @@
{
"id": "localstack-cli",
"version": "0.1.3",
"name": "LocalStack CLI",
"version": "1.0.0",
"name": "LocalStack CLI (lstk)",
"documentationURL": "https://github.com/localstack/devcontainer-feature/tree/main/src/localstack-cli",
"description": "Installs the Localstack CLI along with needed dependencies and popular \"local\" tools.",
"description": "Installs lstk, the LocalStack CLI. lstk starts and manages LocalStack and runs the AWS CLI, Terraform, AWS CDK and AWS SAM against it.",
"options": {
"version": {
"type": "string",
"proposals": [
"",
"none",
"lts",
"latest",
"stable",
"3.6.0",
"3.5.0",
"3.4.0",
"3.3.0",
"3.2.0",
"3.1.0",
"3.0.2",
"3.0.1"
"1.5.0",
"1.4.5"
],
"default": "latest",
"description": "Select or enter a Localstack CLI version."
},
"awslocal": {
"type": "boolean",
"default": false,
"description": "Install awscli-local, a thin wrapper of AWS CLI for LocalStack."
},
"cdklocal": {
"type": "boolean",
"default": false,
"description": "Install aws-cdk-local, a thin wrapper of AWS CDK for LocalStack."
"description": "Select or enter an lstk version (see https://github.com/localstack/lstk/releases)."
},
"pulumilocal": {
"type": "boolean",
"default": false,
"description": "Install pulumi-local, a thin wrapper of Pulumi for LocalStack."
},
"samlocal": {
"type": "boolean",
"default": false,
"description": "Install aws-sam-cli-local, a thin wrapper of AWS SAM CLI for LocalStack."
},
"tflocal": {
"type": "boolean",
"default": false,
"description": "Install terraform-local, a thin wrapper of Terraform for LocalStack."
},
"installUsingPython": {
"type": "boolean",
"description": "Install LocalStack CLI using Python instead of pipx",
"default": false
"description": "Install pulumi-local (pulumilocal), the LocalStack wrapper for Pulumi. lstk has no Pulumi command. Installs pipx and Python."
}
},
"keywords": [
"localstack",
"lstk",
"aws",
"emulator"
],
"installsAfter": [
"ghcr.io/devcontainers/features/python",
"ghcr.io/devcontainers/features/node",
"ghcr.io/devcontainers/features/aws-cli",
"ghcr.io/devcontainers-extra/features/aws-cdk",
"ghcr.io/customink/codespaces-features/sam-cli",
"ghcr.io/devcontainers-extra/features/pulumi",
"ghcr.io/devcontainers/features/terraform"
"ghcr.io/devcontainers/features/python"
]
}
Loading
Loading