From d0d7643b51ba557e606b182fdf5db769d20aa472 Mon Sep 17 00:00:00 2001 From: gatici Date: Mon, 5 Feb 2024 15:42:19 +0300 Subject: [PATCH] Add the Github workflow for the Terraform checks Signed-off-by: gatici --- .github/workflows/main.yaml | 3 +++ .github/workflows/terraform.yaml | 28 ++++++++++++++++++++++++++++ terraform/terraform.tf | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/terraform.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e3efef5..17e9ab9 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -18,6 +18,9 @@ jobs: lint-report: uses: canonical/sdcore-github-workflows/.github/workflows/lint-report.yaml@main + terraform-check: + uses: ./.github/workflows/terraform.yaml + static-analysis: uses: canonical/sdcore-github-workflows/.github/workflows/static-analysis.yaml@main diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml new file mode 100644 index 0000000..c2c7f97 --- /dev/null +++ b/.github/workflows/terraform.yaml @@ -0,0 +1,28 @@ +name: Check the Terraform Module + +on: + workflow_call: + +jobs: + build: + name: Terraform Checks and Plans + runs-on: ubuntu-latest + steps: + - name: Checkout the repository to the runner + uses: actions/checkout@v3 + + - name: HashiCorp - Setup Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Terraform Format + id: fmt + run: terraform fmt -recursive -check + continue-on-error: true + + - name: Terraform Init + id: init + run: terraform init + + - name: Terraform Validate + id: validate + run: terraform validate -no-color \ No newline at end of file diff --git a/terraform/terraform.tf b/terraform/terraform.tf index 545a7bb..4f60bb4 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -1,4 +1,4 @@ -# Copyright 2023 Canonical Ltd. +# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. terraform {