terraform/cloudbuild.yaml (24 lines of code) (raw):

# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. steps: - name: debian:buster-slim dir: terraform entrypoint: bash args: - -c - | cat <<EOF > ci.tf terraform { backend "gcs" { bucket = $_STATE_BUCKET } } EOF - name: hashicorp/terraform:0.14.11 dir: terraform args: ["init"] - name: hashicorp/terraform:0.14.11 dir: terraform args: ["apply", "-auto-approve"] env: - "TF_VAR_billing_account=$_BILLING_ACCOUNT" - "TF_VAR_project_id=$PROJECT_ID" - "TF_VAR_state_bucket=$_STATE_BUCKET"