Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with localstack for testing AWS deployments #145

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
97400ea
Setup integration testing directories for AWS deployments
marwan37 Feb 16, 2024
9e4b989
Add local.tfvars for modular and remote-state integration testing
marwan37 Feb 16, 2024
f4c01b6
Add verify_stack.sh scripts for AWS modular and remote state integrat…
marwan37 Feb 16, 2024
807d256
Add __init__.py in tests/integration
marwan37 Feb 16, 2024
e4d23a1
Create GitHub Actions workflow for AWS integration testing
marwan37 Feb 16, 2024
7242d7f
Add docker-compose.localstack.yml for LocalStack service emulation
marwan37 Feb 16, 2024
6a148f7
Run format and lint scripts
marwan37 Feb 16, 2024
9dcda94
Add README.md for integration tests documentation
marwan37 Feb 16, 2024
9b431b7
Address typo in README
marwan37 Feb 16, 2024
dfe5a29
Add removal of localstack_providers_override.tf in GitHub Actions cle…
marwan37 Feb 17, 2024
b55e115
Revise README for enhanced Docker setup instructions and overall docu…
marwan37 Feb 17, 2024
ada3ca8
Modified CI workflow to fix path issues, emulate tflocal, and ensure …
marwan37 Feb 17, 2024
cd54fe1
Add _override.tf for LocalStack integration in tests
marwan37 Feb 17, 2024
eb3c7c6
Improve verify_stack.sh scripts with debugging outputs
marwan37 Feb 17, 2024
1542cc2
Integrate localstack-aws-integratin-test job into main CI workflow
marwan37 Feb 17, 2024
0ac39f6
Make aws-remote-state/verify_stack.sh executable
marwan37 Feb 18, 2024
b116595
Add workflow dispatch trigger to workflow file
marwan37 Feb 18, 2024
c545ec4
Fix path in cleanup step to correctly delete _override.tf for aws-rem…
marwan37 Feb 18, 2024
dcb7e4d
Update README to reflect workflow and testing approach modifications
marwan37 Feb 18, 2024
056af11
Remove debug line displaying absolute YAML path from workflow and README
marwan37 Feb 18, 2024
63a8fd0
Update .github/workflows/aws-integration-test.yml
marwan37 Feb 19, 2024
0137978
Update tests/integration/aws-modular/local.tfvars
marwan37 Feb 19, 2024
39fa4e6
Update tests/integration/aws-remote-state/local.tfvars
marwan37 Feb 19, 2024
106c6b3
Update tests/integration/README.md
marwan37 Feb 19, 2024
e08a220
Remove cleanup steps from AWS Modular workflow
marwan37 Feb 19, 2024
a9d9737
Update README to reflect changes to terraform version and removal of …
marwan37 Feb 19, 2024
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
103 changes: 103 additions & 0 deletions .github/workflows/aws-integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
permissions:
contents: read
name: LocalStack AWS Integration Test
on:
workflow_call:
marwan37 marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:
jobs:
aws_modular_integration_test:
name: aws_modular_integration_test
runs-on: ubuntu-latest
services:
setup-localstack-service:
image: localstack/localstack
ports:
- '4566:4566'
env:
SERVICES: 's3,iam,sts'
DEFAULT_REGION: eu-north-1
FORCE_NONINTERACTIVE: 1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
steps:
- name: Checkout Repository
uses: actions/[email protected]

- name: Setup Terraform
uses: hashicorp/[email protected]
with:
terraform_version: 1.6.0

- name: Copy Override File
run: |
cp tests/integration/_override.tf src/mlstacks/terraform/aws-modular/_override.tf

- name: Apply Terraform Configuration
run: |
export TF_CLI_ARGS_apply="-compact-warnings"
terraform init -backend-config="path=./terraform.tfstate"
terraform validate
terraform apply -auto-approve -var-file="../../../../tests/integration/aws-modular/local.tfvars"
working-directory: src/mlstacks/terraform/aws-modular

- name: Refresh Terraform State
run: terraform refresh
working-directory: src/mlstacks/terraform/aws-modular

- name: Output Stack YAML Path
id: set_output
run: |
OUTPUT=$(terraform-bin output -raw stack-yaml-path)
echo "stack_yaml_path=$OUTPUT" >> $GITHUB_OUTPUT
working-directory: src/mlstacks/terraform/aws-modular
env:
terraform_wrapper: false

- name: Run Tests to Verify Resource Provisioning
run: |
STACK_YAML_PATH="${{ steps.set_output.outputs.stack_yaml_path }}"
ABSOLUTE_PATH="${GITHUB_WORKSPACE}/src/mlstacks/terraform/aws-modular/${STACK_YAML_PATH}"
../../../../tests/integration/aws-modular/verify_stack.sh "$ABSOLUTE_PATH"
working-directory: src/mlstacks/terraform/aws-modular

aws_remote_state_integration_test:
name: aws_remote_state_integration_test
runs-on: ubuntu-latest
services:
setup-localstack-service:
image: localstack/localstack
ports:
- '4566:4566'
env:
SERVICES: 's3,dynamodb,iam,sts'
DEFAULT_REGION: eu-north-1
FORCE_NONINTERACTIVE: 1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
steps:
- name: Checkout Repository
uses: actions/[email protected]

- name: Setup Terraform
uses: hashicorp/[email protected]
with:
terraform_version: 1.6.0

- name: Copy Override File
run: |
cp tests/integration/_override.tf src/mlstacks/terraform/aws-remote-state/_override.tf

- name: Apply Terraform Configuration for aws-remote-state
run: |
export TF_CLI_ARGS_apply="-compact-warnings"
cd src/mlstacks/terraform/aws-remote-state
terraform init -backend-config="path=./terraform.tfstate"
terraform validate
terraform apply -auto-approve -var-file="../../../../tests/integration/aws-remote-state/local.tfvars"

- name: Run Tests to Verify Resource Provisioning
run: ./tests/integration/aws-remote-state/verify_stack.sh
env:
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: eu-north-1
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ jobs:
files: "."
config: ./.typos.toml

localstack-aws-integration-test:
uses: ./.github/workflows/aws-integration-test.yml
secrets: inherit

aws_test:
name: aws_test
runs-on: ubuntu-latest
Expand Down
Loading
Loading