Update Terraform confluent to v2.20.0 #11
Workflow file for this run
This file contains hidden or 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 CI" | |
on: | |
pull_request: | |
paths: | |
- 'terraform/**' | |
- '.github/workflows/terraform-ci.yml' | |
push: | |
branches: | |
- main | |
paths: | |
- 'terraform/**' | |
- '.github/workflows/terraform-ci.yml' | |
env: | |
TF_VERSION: "1.7.5" | |
jobs: | |
terraform-ci: | |
name: "Terraform CI" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./terraform | |
# These permissions are needed to interact with GitHub's OIDC Token endpoint | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: ${{ env.TF_VERSION }} | |
- name: Terraform Init | |
run: terraform init -backend=false | |
- name: Terraform Format | |
id: fmt | |
run: terraform fmt -check | |
continue-on-error: true | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
env: | |
CONFLUENT_CLOUD_API_KEY: ${{ secrets.CONFLUENT_CLOUD_API_KEY }} | |
CONFLUENT_CLOUD_API_SECRET: ${{ secrets.CONFLUENT_CLOUD_API_SECRET }} | |
TF_VAR_org_id: ${{ secrets.TF_VAR_ORG_ID }} | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate | |
- name: Terraform Plan | |
id: plan | |
run: terraform plan -out=tfplan | |
env: | |
CONFLUENT_CLOUD_API_KEY: ${{ secrets.CONFLUENT_CLOUD_API_KEY }} | |
CONFLUENT_CLOUD_API_SECRET: ${{ secrets.CONFLUENT_CLOUD_API_SECRET }} | |
TF_VAR_org_id: ${{ secrets.TF_VAR_ORG_ID }} | |
continue-on-error: true | |
- name: Update Pull Request | |
uses: actions/github-script@v7 | |
if: github.event_name == 'pull_request' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` | |
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
<details><summary>Show Plan</summary> | |
\`\`\`terraform | |
${{ steps.plan.outputs.stdout }} | |
\`\`\` | |
</details> | |
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) |