added names to the workflows and -auto-approve flag to apply #2
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' | |
| # on: | |
| # workflow_dispatch: # manual action run | |
| on: | |
| push: | |
| branches: | |
| - PP-12736-tf-workflow | |
| permissions: | |
| contents: read | |
| jobs: | |
| terraform: | |
| name: 'Terraform Apply' | |
| runs-on: ubuntu-latest | |
| environment: development | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| # Checkout the repository to the GitHub Actions runner | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| # Install the latest version of Terraform | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| # Run Terraform commands | |
| - name: Terraform Init | |
| run: terraform init | |
| env: | |
| GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
| - name: Terraform Validate | |
| run: terraform validate | |
| env: | |
| GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
| TF_VAR_project_id: ${{ vars.PROJECT_ID }} | |
| TF_VAR_region: ${{ vars.REGION }} | |
| - name: Terraform Apply | |
| run: terraform apply -auto-approve -input=false | |
| env: | |
| GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
| TF_VAR_project_id: ${{ vars.PROJECT_ID }} | |
| TF_VAR_region: ${{ vars.REGION }} | |
| TF_VAR_mx_password: ${{ secrets.MX_PASSWORD }} | |
| TF_VAR_vpc_network: ${{ vars.VPC_NETWORK }} | |
| TF_VAR_subnet_name: ${{ vars.SUBNET_NAME }} | |
| TF_VAR_zone: ${{ vars.ZONE }} | |
| TF_VAR_instance_type: ${{ vars.INSTANCE_TYPE }} | |
| TF_VAR_waf_version: ${{ vars.WAF_VERSION }} | |
| TF_VAR_timezone: ${{ vars.TIMEZONE }} | |
| TF_VAR_ssh_access_source_ranges: ${{ vars.SSH_ACCESS_SOURCE_RANGES }} | |
| TF_VAR_ui_access_source_ranges: ${{ vars.UI_ACCESS_SOURCE_RANGES }} | |
| TF_VAR_deployment_name: ${{ vars.DEPLOYMENT_NAME }} | |
| TF_VAR_instance_name: ${{ vars.INSTANCE_NAME }} |