Refactor workflow file paths and update branch restrictions

This commit is contained in:
2024-10-01 22:56:20 +02:00
parent 270605a619
commit 6d3d101bcc
+18 -8
View File
@@ -8,6 +8,7 @@ on:
- main - main
paths: paths:
- "terraform/iac/**" - "terraform/iac/**"
- .github/workflows/terraform-iac-apply.yml
jobs: jobs:
terraform-apply: terraform-apply:
@@ -22,19 +23,28 @@ jobs:
- name: Setup environment - name: Setup environment
uses: ./.github/actions/setup-env uses: ./.github/actions/setup-env
- name: Setup Terraform Environment - name: Setup Ansible environment
uses: ./.github/actions/setup-terraform-env uses: ./.github/actions/setup-ansible-env
with:
vault-master-password: ${{ secrets.VAULT_MASTER_PASSWORD }}
ansible-user: ${{ secrets.ANSIBLE_USER }}
- name: Get Host Info
uses: ./.github/actions/get-host-info
id: get-host-info
with:
vault-master-password: ${{ secrets.VAULT_MASTER_PASSWORD }}
ansible-user: ${{ secrets.ANSIBLE_USER }}
- name: Setup Terraform environment
uses: ./.github/actions/setup-terraform-env
- name: Terraform Init - name: Terraform Init
env: env:
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }} VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
SYSTEM_ID: ${{ steps.get-host-info.outputs.system-id }}
run: | run: |
cd terraform/iac cd terraform/iac
export TF_VAR_system_id=$SYSTEM_ID
sectool exec terraform init sectool exec terraform init
- name: Terraform Apply
env:
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
run: |
cd terraform/iac
sectool exec terraform apply --auto-approve sectool exec terraform apply --auto-approve