diff --git a/.github/workflows/infra.yml b/.github/workflows/infra.yml new file mode 100644 index 0000000..b2f44d2 --- /dev/null +++ b/.github/workflows/infra.yml @@ -0,0 +1,43 @@ +on: + workflow_dispatch: + pull_request: + branches: ["main"] + paths: ["infra"] + paths-ignore: ["infra/.azure-pipelines"] + push: + branches: ["main"] + paths: ["infra"] + paths-ignore: ["infra/.azure-pipelines"] + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Install TF + uses: hashicorp/setup-terraform@v2.0.3 + with: + terraform_version: latest + + - name: Initialize TF + run: terraform init --backend-config=${{ secrets.TF_BACKEND }} + working-directory: 'infra/provisioning' + + - name: Validate TF + run: terraform validate --backend-config=${{ secrets.TF_BACKEND }} + working-directory: 'infra/provisioning' + + - name: Plan TF + uses: Pwd9000-ML/terraform-azurerm-plan@v1.2.6 + with: + path: 'infra/provisioning' + tf_vars_file: ${{ secrets.TF_VARS }} + az_resource_group: '' + az_container_name: '' + + - name: Apply TF + uses: Pwd9000-ML/terraform-azurerm-apply@v1.2.6 + if: github.event_name != 'pull_request' + with: + az_resource_group: '' + az_container_name: ''