Skip to content

Merge pull request #11 from liyangau/add-au-network #37

Merge pull request #11 from liyangau/add-au-network

Merge pull request #11 from liyangau/add-au-network #37

Workflow file for this run

name: Apply changes
on:
push:
branches:
- main
paths-ignore:
- '**/README.md'
jobs:
apply-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.7.0
tofu_wrapper: false
- name: Terraform Format
id: fmt
run: tofu fmt -check
continue-on-error: true
- name: Terraform Init
id: init
run: tofu init
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_EC2_METADATA_DISABLED: true
- name: Terraform Validate
id: validate
run: tofu validate -no-color
- name: Terraform Plan
id: plan
run: tofu plan -no-color
continue-on-error: false
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_EC2_METADATA_DISABLED: true
TF_VAR_system_token: ${{ secrets.KONNECT_SYSTEM_TOKEN }}
TF_VAR_cp_region: "au"
TF_VAR_exclude_mesh_control_plane: "true"
- name: Terraform Apply
id: apply
if: github.event_name == 'push'
run: tofu apply -no-color -auto-approve -input=false
continue-on-error: false
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_EC2_METADATA_DISABLED: true
TF_VAR_system_token: ${{ secrets.KONNECT_SYSTEM_TOKEN }}
TF_VAR_cp_region: "au"
TF_VAR_exclude_mesh_control_plane: "true"
- name: Generate terraform output
id: output
run: tofu output -no-color -json > ./konnectTFOutput.json
continue-on-error: false
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_EC2_METADATA_DISABLED: true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: tf-output
path: ./konnectTFOutput.json
update-tf-output-gist:
needs: apply-changes
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: tf-output
- name: Upload to Gist
uses: exuanbo/[email protected]
with:
token: ${{ secrets.GH_GIST_TOKEN }}
gist_id: ${{ secrets.GIST_ID }}
file_path: ./konnectTFOutput.json
- name: Delete TF output from artifact
uses: geekyeggo/delete-artifact@v5
with:
name: tf-output