capitalize env #87
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 CI' | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCS_BUCKET_CREDENTIALS_TFSTATE }} | |
jobs: | |
terraform: | |
name: 'Terraform' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create GCP service account 1 | |
run: 'echo "$MINHPVT_GCP" > efiss-terraform-service-account_minhpvt.json' | |
shell: bash | |
env: | |
MINHPVT_GCP: ${{ secrets.MINHPVT_GCP }} | |
- name: Create SSH keys | |
run: 'echo "$SSH_KEYS" > ssh-keys.txt' | |
shell: bash | |
env: | |
SSH_KEYS: ${{ vars.SSH_KEYS }} | |
- name: Create terraform.tfvars | |
run: 'echo "$TERRAFORM_TFVARS" > terraform.tfvars' | |
shell: bash | |
env: | |
TERRAFORM_TFVARS: ${{ secrets.TERRAFORM_TFVARS }} | |
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v2 | |
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. | |
- name: Terraform Init | |
run: terraform init | |
# Generates an execution plan for Terraform | |
- name: Terraform Plan | |
run: terraform plan -input=false | |
# On push to main, build or change infrastructure according to Terraform configuration files | |
# Note: It is recommended to set up a required "strict" status check in your repository for "Terraform Cloud". See the documentation on "strict" required status checks for more information: https://help.github.com/en/github/administering-a-repository/types-of-required-status-checks | |
- name: Terraform Apply | |
if: github.ref == 'refs/heads/main' | |
run: terraform apply -auto-approve -input=false |