chore(deps): update terraform digitalocean to v2.46.1 #797
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform -- Linode-OPS-Test | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
terraform-format: | |
if: | |
github.event_name == 'pull_request' || github.event_name == | |
'workflow_dispatch' | |
runs-on: ubuntu-latest | |
name: Terraform Format | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
# This is only for the GitHub Actions runner, not Terraform Cloud | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3 | |
- name: Terraform Format | |
run: terraform fmt -check | |
working-directory: terraform/ops-test | |
terraform-upgrade-test: | |
if: | |
github.event_name == 'pull_request' || github.event_name == | |
'workflow_dispatch' | |
runs-on: ubuntu-latest | |
name: Terraform Upgrade Test | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
# This is only for the GitHub Actions runner, not Terraform Cloud | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Terraform Upgrade Test | |
run: terraform init -upgrade && terraform plan | |
working-directory: terraform/ops-test | |
terraform-cloud-speculative-run: | |
if: | |
github.event_name == 'pull_request' || github.event_name == | |
'workflow_dispatch' | |
runs-on: ubuntu-latest | |
name: Terraform Cloud Speculative Run | |
permissions: | |
contents: read | |
pull-requests: write | |
env: | |
TF_CLOUD_ORGANIZATION: freecodecamp | |
TF_API_TOKEN: ${{ secrets.TF_API_TOKEN }} | |
TF_WORKSPACE: tfws-ops-test | |
TF_LOG: ERROR | |
CONFIG_DIRECTORY: terraform/ops-test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Terraform Cloud Upload Configuration | |
uses: hashicorp/tfc-workflows-github/actions/upload-configuration@8e08d1ba957673f5fbf971a22b3219639dc45661 # v1.3.2 | |
id: upload | |
with: | |
workspace: ${{ env.TF_WORKSPACE }} | |
directory: ${{ env.CONFIG_DIRECTORY }} | |
speculative: true | |
- name: Terraform Cloud Create Speculative Run | |
uses: hashicorp/tfc-workflows-github/actions/create-run@8e08d1ba957673f5fbf971a22b3219639dc45661 # v1.3.2 | |
id: run | |
with: | |
workspace: ${{ env.TF_WORKSPACE }} | |
configuration_version: | |
${{ steps.upload.outputs.configuration_version_id }} | |
plan_only: true | |
message: 'Triggered From GitHub Actions CI ${{ github.sha }}' | |
- name: Terraform Cloud Plan Output | |
uses: hashicorp/tfc-workflows-github/actions/plan-output@8e08d1ba957673f5fbf971a22b3219639dc45661 # v1.3.2 | |
id: plan-output | |
with: | |
plan: ${{ steps.run.outputs.plan_id }} | |
- name: Find Comment | |
if: github.event_name == 'pull_request' | |
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: Run Details - ${{ env.TF_WORKSPACE }} | |
- name: Create or update comment | |
if: github.event_name == 'pull_request' | |
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
edit-mode: replace | |
body: | | |
Run Details - ${{ env.TF_WORKSPACE }} | |
**Terraform Cloud Plan Output** | |
``` | |
Plan: ${{ steps.plan-output.outputs.add }} to add, ${{ steps.plan-output.outputs.change }} to change, ${{ steps.plan-output.outputs.destroy }} to destroy. | |
``` | |
**Details : <${{ steps.run.outputs.run_link }}>** | |
<table> | |
<tr> | |
<td> | |
Warning | |
</td> | |
<td> | |
<p> | |
Please note that the plan output provided may not accurately reflect the impact on the Terraform project you are currently working on in this Pull Request. The CI checks are merely a sanity test to verify that the versions in the lock file are valid and functional. | |
</p> | |
<p> | |
Confirm the actual Terraform plan by running the corresponding project on your machine or on TFC. | |
</p> | |
</td> | |
</tr> | |
</table> |