feat!: destroy or apply func #5
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: Create Kubernetes Cluster | |
on: push | |
jobs: | |
deploy-terraform: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./terraform | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Terraform | |
id: install-terraform | |
run: wget -O terraform.zip https://releases.hashicorp.com/terraform/1.5.5/terraform_1.5.5_linux_amd64.zip && unzip terraform.zip && chmod +x terraform && sudo mv terraform /usr/local/bin | |
- name: Apply Terraform | |
id: apply-terraform | |
run: terraform init -backend-config="bucket=tf-state-${{ secrets.PROJECT_ID }}" && terraform workspace select ${GITHUB_REF##*/} || terraform workspace new ${GITHUB_REF##*/} && terraform apply -auto-approve -var="project_id=${{ secrets.PROJECT_ID }}" -var="branch=${GITHUB_REF##*/}" | |
# Provider google will get the credentials from env variable called GCP_CREDENTIALS | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} |