templates/tfengine/components/cicd/configs/tf-validate.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: 600s
substitutions:
_TERRAFORM_ROOT: "."
_MANAGED_DIRS: ""
_WORKER_POOL: ""
_LOGS_BUCKET: ""
steps:
- name: "{{$cft}}"
entrypoint: terraform
args: ["version"]
id: Terraform version
- name: "{{$cft}}"
entrypoint: terraform
args: ["fmt", "-recursive", "-check"]
dir: "${_TERRAFORM_ROOT}"
id: Terraform configs format check
- name: "{{$cft}}"
entrypoint: bash
args: ["./cicd/configs/run.sh", "-d", "${_MANAGED_DIRS}", "-a", "init -backend=false", "-a", "validate"]
dir: "${_TERRAFORM_ROOT}"
id: Validate
logs_bucket: "${_LOGS_BUCKET}"
options:
pool:
name: "${_WORKER_POOL}"