Skip to content

Add GitHub Actions workflow for Terraform checks #4

Add GitHub Actions workflow for Terraform checks

Add GitHub Actions workflow for Terraform checks #4

Workflow file for this run

name: OpenTofu Checks
on:
pull_request:
branches:
- main
jobs:
opentofu:
name: OpenTofu Checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup OpenTofu
uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.6.0-beta3
- name: Verify OpenTofu Installation
run: tofu version
- name: OpenTofu Format Check
id: fmt
run: tofu fmt -check -recursive
continue-on-error: true
- name: OpenTofu Init
run: tofu init
working-directory: ./terraform/modules/galileo-aks
- name: OpenTofu Validate
run: tofu validate
working-directory: ./terraform/modules/galileo-aks
- name: Install TFLint
run: |
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
- name: TFLint
run: tflint
working-directory: ./terraform/modules/galileo-aks
- name: Install tfsec
run: |
curl -s https://raw.githubusercontent.com/aquasecurity/tfsec/master/scripts/install_linux.sh | bash
- name: tfsec
run: tfsec
working-directory: ./terraform/modules/galileo-aks
- name: OpenTofu Plan
run: tofu plan
working-directory: ./terraform/modules/galileo-aks
env:
TF_VAR_example: "example"
- name: OpenTofu Init for EKS
run: tofu init
working-directory: ./terraform/modules/galileo-eks
- name: OpenTofu Validate for EKS
run: tofu validate
working-directory: ./terraform/modules/galileo-eks
- name: TFLint for EKS
run: tflint
working-directory: ./terraform/modules/galileo-eks
- name: tfsec for EKS
run: tfsec
working-directory: ./terraform/modules/galileo-eks
- name: OpenTofu Plan for EKS
run: tofu plan
working-directory: ./terraform/modules/galileo-eks
env:
TF_VAR_example: "example"
- name: OpenTofu Init for GKE
run: tofu init
working-directory: ./terraform/modules/galileo-gke
- name: OpenTofu Validate for GKE
run: tofu validate
working-directory: ./terraform/modules/galileo-gke
- name: TFLint for GKE
run: tflint
working-directory: ./terraform/modules/galileo-gke
- name: tfsec for GKE
run: tfsec
working-directory: ./terraform/modules/galileo-gke
- name: OpenTofu Plan for GKE
run: tofu plan
working-directory: ./terraform/modules/galileo-gke
env:
TF_VAR_example: "example"
- name: Check Formatting Result
if: steps.fmt.outcome == 'failure'
run: exit 1