Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
iabhee committed Dec 20, 2024
1 parent 1a39375 commit 98eea39
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/terraform-apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ jobs:
run: terraform init
working-directory: ${{ env.CONFIG_DIRECTORY }}

- name: Mask Azure Subscription ID
run: |
SUBSCRIPTION_ID=$(terraform plan | grep -oP '/subscriptions/\K[a-f0-9-]+')
if [ -n "$SUBSCRIPTION_ID" ]; then
echo "::add-mask::$SUBSCRIPTION_ID"
fi
- name: Terraform Plan
id: plan
run: terraform plan
Expand All @@ -42,6 +49,7 @@ jobs:
working-directory: ${{ env.CONFIG_DIRECTORY }}

- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && contains(github.event.head_commit.message, 'Merge pull request')
run: terraform apply -auto-approve
working-directory: ${{ env.CONFIG_DIRECTORY }}

19 changes: 18 additions & 1 deletion .github/workflows/terraform-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,28 @@ jobs:
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

- name: Terraform Format
id: fmt
run: terraform fmt -write
continue-on-error: true

- name: Terraform init
id: init
run: terraform init
working-directory: ${{ env.CONFIG_DIRECTORY }}


- name: Mask Azure Subscription ID
run: |
SUBSCRIPTION_ID=$(terraform plan | grep -oP '/subscriptions/\K[a-f0-9-]+')
if [ -n "$SUBSCRIPTION_ID" ]; then
echo "::add-mask::$SUBSCRIPTION_ID"
fi
- name: Terraform Validate
id: validate
run: terraform validate -no-color
continue-on-error: true

- name: Terraform Plan
id: plan
run: terraform plan
Expand Down

0 comments on commit 98eea39

Please sign in to comment.