Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f05124d
test(terraform): apply modules against MiniStack
edersonbrilhante Aug 24, 2026
ec6f80f
docs: auto update terraform docs
github-actions[bot] Aug 24, 2026
81bd905
test(terraform): apply default example against MiniStack
edersonbrilhante Aug 24, 2026
3629b6d
docs: auto update terraform docs
github-actions[bot] Aug 24, 2026
00fd828
test(terraform): apply examples against MiniStack
edersonbrilhante Aug 24, 2026
b383c18
docs: auto update terraform docs
github-actions[bot] Aug 24, 2026
17eb207
fix(ci): trust GitHub Actions checkout
edersonbrilhante Aug 24, 2026
bddcabf
fix(ci): add Linux provider checksums
edersonbrilhante Aug 24, 2026
d4d3b68
refactor(ci): apply MiniStack tests to examples directly
edersonbrilhante Aug 25, 2026
75452e1
fix: undo changes
edersonbrilhante Aug 26, 2026
40d3d97
test(terraform): run examples against MiniStack directly
edersonbrilhante Aug 26, 2026
739135e
fix(ci): isolate MiniStack example configuration
edersonbrilhante Aug 26, 2026
e96251e
docs: auto update terraform docs
github-actions[bot] Aug 26, 2026
fca4806
test(ministack): run examples with tfvars only
edersonbrilhante Sep 2, 2026
09da55c
docs: auto update terraform docs
github-actions[bot] Sep 2, 2026
8e5fea0
revert(ministack): restore examples and remove setup
edersonbrilhante Sep 2, 2026
97834e5
fix(ministack): generate lambda and ssm fixtures
edersonbrilhante Sep 2, 2026
390b4da
chore(ministack): remove unused provider tfvars
edersonbrilhante Sep 2, 2026
50df901
fix(ministack): configure example AMIs
edersonbrilhante Sep 2, 2026
b0d3a9e
docs: auto update terraform docs
github-actions[bot] Sep 2, 2026
082fb3c
fix(ministack): seed fixtures through AWS APIs
edersonbrilhante Sep 2, 2026
84b6021
fix(ministack): keep example modules unchanged
edersonbrilhante Sep 2, 2026
22a00fa
fix(ci): use readonly MiniStack provider locks
edersonbrilhante Sep 4, 2026
9ce9602
fix(ministack): remove unused termination watcher variables
edersonbrilhante Sep 4, 2026
9fe8313
docs: auto update terraform docs
github-actions[bot] Sep 4, 2026
c9c368f
test(ministack): expand v1.5.7 example coverage
edersonbrilhante Sep 4, 2026
6cbe2c9
docs: auto update terraform docs
github-actions[bot] Sep 4, 2026
224f702
test(ministack): cover Terraform 1.4.0 and latest
edersonbrilhante Sep 4, 2026
a1a807c
chore(dependabot): track MiniStack Compose image
edersonbrilhante Sep 4, 2026
a749bee
docs(adr): remove implementation references
edersonbrilhante Sep 4, 2026
2ca1c82
fix(ci): add Linux provider checksums
edersonbrilhante Sep 4, 2026
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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ updates:
- dependency-name: "mcr.microsoft.com/vscode/devcontainers/typescript-node"
update-types: ["version-update:semver-major"]

- package-ecosystem: "docker-compose"
directory: "/"
schedule:
interval: "weekly"
allow:
- dependency-name: "ghcr.io/ministackorg/ministack"

- package-ecosystem: "pip"
directory: "/.github/workflows/mkdocs"
schedule:
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/ministack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: "MiniStack Terraform lifecycle"

on:
push:
branches:
- main
paths:
- ".github/workflows/ministack.yml"
- "tests/ministack/**"
- "*.tf"
- "policies/**"
- "examples/**"
- "modules/**"
pull_request:
paths:
- ".github/workflows/ministack.yml"
- "tests/ministack/**"
- "*.tf"
- "policies/**"
- "examples/**"
- "modules/**"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
AWS_ACCESS_KEY_ID: "000000000000"
AWS_DEFAULT_REGION: eu-west-1
AWS_EC2_METADATA_DISABLED: "true"
AWS_ENDPOINT_URL: http://127.0.0.1:4566
AWS_REGION: eu-west-1
AWS_SECRET_ACCESS_KEY: test-only
TF_IN_AUTOMATION: "true"
TF_INPUT: "false"

jobs:
terraform_lifecycle:
name: Apply/destroy ${{ matrix.example }} against MiniStack (Terraform ${{ matrix.terraform }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
max-parallel: 4
matrix:
example:
- base
- prebuilt
- default
- ephemeral
- multi-runner
- termination-watcher
terraform:
- "1.4.0"
- latest
services:
ministack:
image: ghcr.io/ministackorg/ministack:1.5.7@sha256:37361b9ef886463d5632d5a4b2d114da4b7a5c5793f52f07dbc72579f2fd9207
ports:
- 4566:4566
env:
MINISTACK_ACCOUNT_ID: "000000000000"
MINISTACK_REGION: eu-west-1
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup Terraform
uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4.0.1
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false

- name: Mark repository as safe
shell: sh
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- id: init
name: Terraform init
env:
EXAMPLE: ${{ matrix.example }}
run: tests/ministack/run-example.sh init "$EXAMPLE"

- id: apply
name: Terraform apply
env:
EXAMPLE: ${{ matrix.example }}
run: tests/ministack/run-example.sh apply "$EXAMPLE"

- name: Terraform destroy
if: always() && steps.init.outcome == 'success'
env:
EXAMPLE: ${{ matrix.example }}
run: tests/ministack/run-example.sh destroy "$EXAMPLE"
87 changes: 87 additions & 0 deletions docs/adr/0001-use-ministack-for-terraform-integration-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# ADR 0001: Use MiniStack for Terraform integration tests

- Status: Accepted
- Date: 2026-09-04

## Context

The repository contains Terraform examples that create and connect several AWS
services. Static validation and unit tests do not exercise the provider calls,
resource lifecycle, or interactions between services. We therefore need a
local AWS emulator for integration tests in CI and during development.

The test provider must be free to run in CI, compatible with the AWS Terraform
provider, and sufficiently compatible with the AWS APIs used by the examples.
This decision was developed while implementing [PR #5293](https://github.com/github-aws-runners/terraform-aws-github-runner/pull/5293)
and discussing [MiniStack issue #1611](https://github.com/ministackorg/ministack/issues/1611#issuecomment-5537737162).

We considered three mature local AWS emulators:

| Provider | Relevant advantages | Trade-offs for this repository |
| --- | --- | --- |
| [LocalStack](https://localstack.cloud/) | Established ecosystem, broad AWS service coverage, and Terraform/SDK integrations. A free tier is available, with additional paid tiers and authenticated AWS features. | The current licensing and authentication model adds account/token and tier considerations to open-source CI. The exact capability needed by the examples must also be verified for the selected edition. |
| [Floci](https://github.com/floci-io/floci) | MIT-licensed, free, and designed for local development and CI. Its documentation advertises a broad AWS service matrix and a single AWS-compatible endpoint. | Its service coverage and compatibility are evolving. The repository would need to validate the APIs and Terraform behavior it consumes before adopting it. |
| [MiniStack](https://github.com/ministackorg/ministack) | MIT-licensed and free, supports Terraform and multi-account/multi-region emulation, and provides the AWS services required by the current examples when using v1.5.7+. | It is still an emulator, so unsupported or subtly different AWS behavior can remain. The version must be pinned and upgraded deliberately. |

The number of services advertised by each provider is not a stable selection
criterion: service catalogs and compatibility change frequently. The decision
is based on the behavior required by this repository, the ability to run the
same tests without paid credentials, and the current operational fit.

## Decision

Use MiniStack v1.5.7 or later as the default local AWS emulator for Terraform
integration tests.

The integration-test harness must:

1. Pin the MiniStack image to a known version or digest and upgrade it as an
explicit test-provider change.
2. Configure the AWS Terraform provider to use MiniStack endpoints and
test-only credentials so tests cannot accidentally reach AWS.
3. Seed service-specific fixtures, such as AMIs and SSM parameters, in the
test harness or MiniStack initialization rather than changing production
examples solely to accommodate the emulator.
4. Run each isolated example against clean emulator state to prevent resource
names and state from leaking between tests.
5. Treat successful MiniStack tests as local integration evidence, not as a
substitute for tests against real AWS behavior.

## Provider replacement boundary

The examples and reusable Terraform modules must not depend on MiniStack-only
resources or APIs. Provider-specific behavior belongs in the integration-test
harness, including endpoint configuration, credentials, initialization
fixtures, reset behavior, and cleanup.

If MiniStack no longer satisfies the required AWS behavior, the harness may be
adapted to LocalStack, Floci, or another compatible emulator. A replacement
must pass the same example and API contract tests before it becomes the
default. This keeps the provider choice replaceable without changing the
production module interface.

## Consequences

### Positive

- CI and local integration tests can run without an AWS account or paid
emulator subscription.
- The selected version supports the AWS API behavior needed by the examples.
- Test-only fixture setup keeps production examples representative of real AWS
usage.
- The provider replacement boundary limits future migration work to the test
harness and its fixtures.

### Negative

- MiniStack behavior can differ from AWS and must not be treated as complete
AWS certification.
- Pinning the emulator requires deliberate maintenance when the AWS provider,
examples, or MiniStack API behavior changes.

## References

- [MiniStack v1.5.7 release notes](https://github.com/ministackorg/ministack/releases/tag/v1.5.7)
- [MiniStack service and Terraform documentation](https://github.com/ministackorg/ministack)
- [Floci service matrix](https://floci.io/floci/services/)
- [LocalStack pricing comparison](https://www.localstack.cloud/pricing-comparison)
36 changes: 19 additions & 17 deletions examples/base/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 6.0.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 6.63.0 |

## Modules

Expand Down
Loading