/** * Copyright 2025 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. */ variable "annotations" { description = "Resource annotations." type = map(string) default = {} nullable = false } variable "automations" { description = "Configuration for automations associated with the deployment pipeline in a name => attributes format." type = map(object({ project_id = optional(string, null) region = optional(string, null) annotations = optional(map(string)) description = optional(string, null) labels = optional(map(string)) service_account = optional(string, null) suspended = optional(bool, false) advance_rollout_rule = optional(object({ id = optional(string, "advance-rollout") source_phases = optional(list(string), null) wait = optional(string, null) })) promote_release_rule = optional(object({ id = optional(string, "promote-release") wait = optional(string, null) destination_target_id = optional(string, null) destination_phase = optional(string, null) })) repair_rollout_rule = optional(object({ id = optional(string, "repair-rollout") phases = optional(list(string), null) jobs = optional(list(string), null) retry = optional(object({ attempts = optional(string, null) wait = optional(string, null) backoff_mode = optional(string, null) })) rollback = optional(object({ destination_phase = optional(string, null) disable_rollback_if_rollout_pending = optional(bool, true) })) })) timed_promote_release_rule = optional(object({ id = optional(string, "timed-promote-release") destination_target_id = optional(string, null) schedule = optional(string, null) time_zone = optional(string, null) destination_phase = optional(string, null) })) selector = optional(list(object({ id = optional(string, "*") labels = optional(map(string), {}) })), [{ id = "*" }]) })) default = {} nullable = false validation { condition = alltrue([ for k, v in var.automations : !(v.promote_release_rule == null && v.advance_rollout_rule == null && v.repair_rollout_rule == null && v.timed_promote_release_rule == null) ]) error_message = < 0 || length(vv.one_time_windows) > 0) ? 0 : 1]) == 0 ]) error_message = <= 0 && p < 100 : p >= 0 && p < 100 && p > v.deployment_percentages[i - 1] ]) ]) error_message = "For canary strategy, deployment percentages must be in ascending order and each percentage must be between 0 and 99." } }