feat: Add the Terraform module #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2024 Canonical Ltd. | |
# See LICENSE file for licensing details. | |
name: Check Terraform Module | |
on: | |
pull_request: | |
jobs: | |
check-terraform: | |
name: Check Terraform | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./terraform | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Initialize Terraform Module | |
id: init | |
run: terraform init | |
- name: Validate Terraform Module | |
id: validate | |
run: terraform validate -no-color | |
- name: Validate terraform fmt | |
run: | | |
set +e | |
terraform fmt -recursive -check -diff | |
FMT_STATUS="$?" | |
if [[ "$FMT_STATUS" -ne 0 ]]; then | |
echo "❌ terraform fmt failed" >> "$GITHUB_STEP_SUMMARY" | |
fi | |
exit "$FMT_STATUS" |