templates/tfengine/components/cicd/configs/tf-plan.yaml (26 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.
# Note: Terraform version used in the automation is 0.14.8.
{{- $cft := "gcr.io/cloud-foundation-cicd/cft/developer-tools-light@sha256:e4ef6a7cb46ca110b97eb5fb7134fb9f3720b98560436792a4199c77e739dca0"}}
timeout: 1200s
substitutions:
_TERRAFORM_ROOT: "."
_MANAGED_DIRS: ""
_WORKER_POOL: ""
_LOGS_BUCKET: ""
steps:
- name: "{{$cft}}"
entrypoint: terraform
args: ["version"]
id: Terraform version
- name: "{{$cft}}"
entrypoint: bash
args: ["./cicd/configs/run.sh", "-d", "${_MANAGED_DIRS}", "-a", "init -lock=false", "-a", "plan -lock=false -out=plan.tfplan"]
dir: "${_TERRAFORM_ROOT}"
id: Speculative plan
# Check for delete operations as an FYI, it won't fail the build.
- name: "{{$cft}}"
entrypoint: bash
args: ["./cicd/configs/tf-deletion-check.sh", "./cicd/configs/tf-deletion-allowlist.txt"]
dir: "${_TERRAFORM_ROOT}"
id: Resource deletion check
logs_bucket: "${_LOGS_BUCKET}"
options:
pool:
name: "${_WORKER_POOL}"