From 2e549ae1b517b964e188d3575f9cf22138becfc7 Mon Sep 17 00:00:00 2001 From: zcemycl Date: Sun, 7 Apr 2024 16:55:32 +0100 Subject: [PATCH] add ci --- .github/workflows/main.yml | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..0f34d3f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,46 @@ +name: Terraform CI + +on: + push: + branches: + - "*" + pull_request: + branches: + - "*" + +jobs: + lint: + strategy: + fail-fast: false + matrix: + terraform-version: ["3.11"] + os: [ubuntu-22.04, macos-latest, windows-latest] + path: + - src/tf/batch-lambda + - src/tf/aurora-postgres-rds + - src/tf/cognito-app/infrastructure + + runs-on: ${{ matrix.os }} + steps: + - name: Checkout the repository to the runner + uses: actions/checkout@v2 + + - name: Setup Terraform with specified version on the runner + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: ${{ matrix.terraform-version }} + + - name: Terraform init + working-directory: ${{ matrix.path }} + id: init + run: terraform init + + - name: Terraform format + working-directory: ${{ matrix.path }} + id: fmt + run: terraform fmt -check + + - name: Terraform validate + working-directory: ${{ matrix.path }} + id: validate + run: terraform validate