Skip to content

Commit

Permalink
Update GitHub Actions workflows to use node20 (Azure-Samples#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjcorr authored Mar 28, 2024
1 parent 2a0f34f commit f4eb48d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tf-drift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install the latest version of the Terraform CLI
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: false

Expand All @@ -61,7 +61,7 @@ jobs:
# Save plan to artifacts
- name: Publish Terraform Plan
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: tfplan
path: tfplan
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
# If changes are detected, create a new issue
- name: Publish Drift Report
if: steps.tf-plan.outputs.exitcode == 2
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
SUMMARY: "${{ steps.tf-plan-string.outputs.summary }}"
with:
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
# If changes aren't detected, close any open drift issues
- name: Publish Drift Report
if: steps.tf-plan.outputs.exitcode == 0
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/tf-plan-apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install the latest version of the Terraform CLI
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: false

Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
# Save plan to artifacts
- name: Publish Terraform Plan
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: tfplan
path: tfplan
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
# If this is a PR post the changes
- name: Push Terraform Output to PR
if: github.ref != 'refs/heads/main'
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
SUMMARY: "${{ steps.tf-plan-string.outputs.summary }}"
with:
Expand All @@ -125,19 +125,19 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
uses: hashicorp/setup-terraform@v3

# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init

# Download saved plan from artifacts
- name: Download Terraform Plan
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: tfplan

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/tf-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: 'Terraform Unit Tests'
on:
push:

permissions:
security-events: write # Needed to upload-sarif
contents: read # Needed to clone repo
actions: read # Potentially needed for private repositories (see https://github.com/github/codeql-action/issues/2117)

jobs:
terraform-unit-tests:
name: 'Terraform Unit Tests'
Expand All @@ -11,11 +16,11 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
uses: hashicorp/setup-terraform@v3

# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
Expand All @@ -39,7 +44,7 @@ jobs:
# Upload results to GitHub Advanced Security
- name: Upload SARIF file
if: success() || failure()
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
category: checkov
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ To use these workflows in your environment several prerequisite steps are requir

## Additional Resources

A companion article detailing how to use GitHub Actions to deploy to Azure using IaC can be found at the [DevOps Resource Center](). `TODO: add link`
A companion article detailing how to use GitHub Actions to deploy to Azure using IaC can be found at the [DevOps Resource Center](https://learn.microsoft.com/devops/deliver/iac-github-actions).

0 comments on commit f4eb48d

Please sign in to comment.