Skip to content

Commit

Permalink
fix workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rgildein committed May 17, 2024
1 parent 812340b commit 908d73f
Showing 1 changed file with 41 additions and 40 deletions.
81 changes: 41 additions & 40 deletions .github/workflows/terraform-apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,46 @@ on:
- main
paths:
- terraform-plans/**
on:
push:
branches:
- main
paths:
- terraform-plans/**
push:
branches:
- main
paths:
- terraform-plans/**

jobs:
runs-on: ubuntu-latest
env:
GITHUB_APP_ID: ${{ secrets.SOLENG_APP_ID }}
GITHUB_APP_INSTALLATION_ID: ${{ secrets.SOLENG_APP_INSTALLATION_ID }}
GITHUB_APP_PEM_FILE: ${{ secrets.SOLENG_APP_PEM_FILE }}
strategy:
fail-fast: false
matrix:
repository:
- soleng-tf-test-repo
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Install Terraform
uses: sudo snap install terraform
- name: Terraform init
working-directory: ./terraform-plans
run: terraform init
- name: Terraform validate
working-directory: ./terraform-plans
run: terraform validate --no-color
- name: Terraform plan
working-directory: ./terraform-plans
run: |
terraform plan -no-color \
-var-file=configs/github.tfvars \
-var-file=configs/${{ matrix.repository }}.tfvars
- name: Terraform Apply only on merge to main
if: ${{ github.event_name == 'push' }}
working-directory: ./terraform-plans
run: |
terraform apply -no-color -auto-approve \
-var-file=configs/github.tfvars \
-var-file=configs/${{ matrix.repository }}.tfvars
terraform:
name: Run Terraform
runs-on: ubuntu-latest
env:
GITHUB_APP_ID: ${{ secrets.SOLENG_APP_ID }}
GITHUB_APP_INSTALLATION_ID: ${{ secrets.SOLENG_APP_INSTALLATION_ID }}
GITHUB_APP_PEM_FILE: ${{ secrets.SOLENG_APP_PEM_FILE }}
strategy:
fail-fast: false
matrix:
repository:
- soleng-tf-test-repo
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Install Terraform
run: sudo snap install terraform --classic
- name: Terraform init
working-directory: ./terraform-plans
run: terraform init
- name: Terraform validate
working-directory: ./terraform-plans
run: terraform validate -no-color
- name: Terraform plan
working-directory: ./terraform-plans
run: |
terraform plan -no-color \
-var-file=configs/github.tfvars \
-var-file=configs/${{ matrix.repository }}.tfvars
- name: Terraform Apply only on merge to main
if: ${{ github.event_name == 'push' }}
working-directory: ./terraform-plans
run: |
terraform apply -no-color -auto-approve \
-var-file=configs/github.tfvars \
-var-file=configs/${{ matrix.repository }}.tfvars

0 comments on commit 908d73f

Please sign in to comment.