Skip to content

Repository files navigation

Terraform init hooks extension demo

A sample of a Terraform configuration file highlighting its usage with LocalStack init hooks and Testcontainers

architecture-diagram.png

Prerequisites

Authenticate once with lstk login, or export your token:

export LOCALSTACK_AUTH_TOKEN=<your-auth-token>

Running with lstk

lstk reads the container's environment variables and bind mounts from .lstk/config.toml, which installs the localstack-extension-terraform-init extension and mounts terraform/ into /etc/localstack/init/ready.d so main.tf is applied as a READY init hook.

make build   # builds the Lambda JAR and stages it into terraform/target/
make start   # lstk start

Once the Ready. message appears, exercise the stack:

lstk status        # list the deployed resources
./invoke.sh        # POST two products, then GET one back

Stop it with make stop.

Running with Docker Compose

docker-compose.yml is an alternative to lstk and mounts the same paths:

docker compose up

About

Demo using Terraform configuration files as init hooks

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages