#!/usr/bin/env bash set -euo pipefail command -v terraform >/dev/null || { echo "Terraform 1.6.x is required" >&2; exit 1; } terraform -chdir=terraform fmt -check -diff terraform -chdir=terraform init -backend=false -input=false terraform -chdir=terraform validate if [[ -z "${TF_VAR_project_id:-}" || -z "${TF_VAR_invoker_service_account:-}" ]]; then echo "Set TF_VAR_project_id and TF_VAR_invoker_service_account for plan check" >&2 exit 2 fi terraform -chdir=terraform plan -refresh=false -input=false -lock=false -out=/tmp/gcp-solution.tfplan >/tmp/gcp-solution.plan cat /tmp/gcp-solution.plan