Skip to content

GKE Cluster

GKE Cluster #1

Workflow file for this run

name: GKE Cluster
on:
workflow_dispatch:
inputs:
action:
description: 'Action'
required: false
default: 'apply'
type: choice
options:
- apply
- destroy
env:
TF_CLI_CONFIG_FILE: ${{ secrets.TF_CLI_CONFIG_FILE }}
jobs:
cluster:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Authenticate into gcloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Install gcloud CLI
uses: google-github-actions/[email protected]
- name: Install gcloud k8s auto component
run: gcloud components install gke-gcloud-auth-plugin
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
- name: Create Terraform Cloud descriptor
run: cp ./gke/terraform.cloud.tf.example ./gke/terraform.cloud.tf
- name: Stand up GKE cluster
run: |
cd gke
terraform init
terraform ${{ inputs.action }} \
--var="project=${{ secrets.GCP_PROJECT }}" \
--var="cluster_location=${{ vars.GCP_CLUSTER_LOCATION }}" \
--var="cluster_machine_type=${{ vars.GCP_CLUSTER_MACHINE_TYPE }}" \
--auto-approve