diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml new file mode 100644 index 0000000..bd72d3b --- /dev/null +++ b/.github/workflows/terraform.yml @@ -0,0 +1,41 @@ +name: 'Terraform' + +on: + push: + branches: [ "cloud" ] + +permissions: + contents: read + +jobs: + terraform: + name: 'Terraform' + runs-on: ubuntu-latest + environment: production + + defaults: + run: + shell: bash + working-directory: ./terraform + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} + + - name: Terraform Init + run: terraform init + + - name: Terraform Format + run: terraform fmt -check + + - name: Terraform Plan + run: terraform plan -input=false + + - name: Terraform Apply + if: github.ref == 'refs/heads/"cloud"' && github.event_name == 'push' + run: terraform apply -auto-approve -input=false