Terraform test build #22
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 test build | |
on: | |
schedule: | |
- cron: "15 06 * * 2" # <=== Change this value | |
workflow_dispatch: | |
inputs: | |
directory: | |
type: string | |
default: './terraform' | |
jobs: | |
terraform-build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ${{ inputs.directory || './terraform' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- name: Install terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Install Nodejs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Terraform Init | |
id: init | |
run: terraform init -backend-config="access_key=${{secrets.access_key}}" -backend-config="storage_account_name=${{secrets.storage_account_name}}" -backend-config="container_name=${{secrets.container_name}}" -backend-config="key=azfunction-aca" | |
- name: Terraform Apply | |
id: apply | |
run: terraform apply --auto-approve -input=false -var="spn-client-id=${{secrets.spn_client_id}}" -var="spn-client-secret=${{secrets.spn_client_secret}}" -var="spn-tenant-id=${{secrets.AZURE_TENANT_ID}}" -var="subscription-id=${{secrets.subscription_id}}" | |
continue-on-error: false | |
- name: Terraform init reconfigure | |
run: terraform init -reconfigure -backend-config="access_key=${{secrets.access_key}}" -backend-config="storage_account_name=${{secrets.storage_account_name}}" -backend-config="container_name=${{secrets.container_name}}" -backend-config="key=azfunction-aca" | |
continue-on-error: false | |
- name: Terraform Destroy | |
id: destroy | |
run: terraform destroy --auto-approve -input=false -var="spn-client-id=${{secrets.spn_client_id}}" -var="spn-client-secret=${{secrets.spn_client_secret}}" -var="spn-tenant-id=${{secrets.AZURE_TENANT_ID}}" -var="subscription-id=${{secrets.subscription_id}}" | |
continue-on-error: false | |
- name: Build-A-Badge-Success | |
if: success() | |
uses: peterrhodesdev/build-a-badge@v1.3.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
filename: azure-funtion-on-azure-container-apps | |
label: azure-funtion-on-azure-container-apps | |
message: "build date: ${{ steps.date.outputs.date }}" | |
namedLogo: github | |
labelColor: "#008000" | |
color: "#3272d3" | |
- name: Build-A-Badge-Failure | |
if: failure() | |
uses: peterrhodesdev/build-a-badge@v1.3.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
filename: azure-funtion-on-azure-container-apps | |
label: azure-funtion-on-azure-container-apps | |
message: "build date: ${{ steps.date.outputs.date }}" | |
namedLogo: github | |
labelColor: "#FF0000" | |
color: "#3272d3" |