From f8f30d03361b1279674aedec098c6271b01b2ca2 Mon Sep 17 00:00:00 2001 From: Alejandro Garrido Mota Date: Tue, 2 Feb 2021 15:38:08 +0000 Subject: [PATCH 1/2] Testing GH action --- .github/workflows/unit.yml | 15 ++++++++++++--- test/unit-test/main.tf | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index baa8bb4..2f6f364 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -6,9 +6,18 @@ jobs: go-tests: name: Run Terratest Unit Tests runs-on: ubuntu-latest - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + services: + localstack: + image: localstack/localstack:latest + env: + SERVICES: iam,sts,s3 + DEFAULT_REGION: eu-west-2 + AWS_ACCESS_KEY_ID: localkey + AWS_SECRET_ACCESS_KEY: localsecret + HOSTNAME_EXTERNAL: localstack + ports: + - 4566:4566 + - 4571:4571 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/test/unit-test/main.tf b/test/unit-test/main.tf index 17e2b6f..614756f 100644 --- a/test/unit-test/main.tf +++ b/test/unit-test/main.tf @@ -3,7 +3,20 @@ terraform { } provider "aws" { - region = "eu-west-2" + access_key = "mock_access_key" + secret_key = "mock_secret_key" + region = "eu-west-2" + s3_force_path_style = true + skip_credentials_validation = true + skip_metadata_api_check = true + skip_requesting_account_id = true + + endpoints { + ec2 = "http://localhost:4566" + iam = "http://localhost:4566" + s3 = "http://localhost:4566" + sts = "http://localhost:4566" + } } module "s3" { From bda6f7a061a7325eef3d8e8729c41e21575a42da Mon Sep 17 00:00:00 2001 From: Alejandro Garrido Mota Date: Tue, 2 Feb 2021 16:01:02 +0000 Subject: [PATCH 2/2] Update unit.yml --- .github/workflows/unit.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 2f6f364..056d2bd 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -12,9 +12,6 @@ jobs: env: SERVICES: iam,sts,s3 DEFAULT_REGION: eu-west-2 - AWS_ACCESS_KEY_ID: localkey - AWS_SECRET_ACCESS_KEY: localsecret - HOSTNAME_EXTERNAL: localstack ports: - 4566:4566 - 4571:4571