Skip to content

Commit

Permalink
Update github-actions.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
HoussemDellai authored Jan 6, 2024
1 parent c99014a commit 9bb3445
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest

strategy:
matrix:
directory: [001_vnet_subnets_tf, 002_vm_bastion]
# node: [14, 16]

# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
Expand Down Expand Up @@ -46,22 +50,22 @@ jobs:
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform -chdir=001_vnet_subnets_tf init
run: terraform -chdir=${{ matrix.directory }} init

# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Format
run: terraform -chdir=001_vnet_subnets_tf fmt -check
run: terraform -chdir=${{ matrix.directory }} fmt -check

# Generates an execution plan for Terraform
- name: Terraform Plan
run: terraform -chdir=001_vnet_subnets_tf plan -out tfplan
run: terraform -chdir=${{ matrix.directory }} plan -out tfplan

# On push to "main", build or change infrastructure according to Terraform configuration files
# Note: It is recommended to set up a required "strict" status check in your repository for "Terraform Cloud". See the documentation on "strict" required status checks for more information: https://help.github.com/en/github/administering-a-repository/types-of-required-status-checks
- name: Terraform Apply
run: terraform -chdir=001_vnet_subnets_tf apply tfplan
run: terraform -chdir=${{ matrix.directory }} apply tfplan
# if: github.ref == 'refs/heads/"main"' && github.event_name == 'push'

# Terraform Destroy
- name: Terraform Destroy
run: terraform -chdir=001_vnet_subnets_tf destroy -auto-approve -input=false
run: terraform -chdir=${{ matrix.directory }} destroy -auto-approve -input=false

0 comments on commit 9bb3445

Please sign in to comment.