2021-10-31 14:40:28 -07:00
|
|
|
|
|
|
|
/**
|
2022-01-01 06:52:31 -08:00
|
|
|
* Copyright 2022 Google LLC
|
2021-10-31 14:40:28 -07:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2023-04-01 05:06:29 -07:00
|
|
|
variable "container_concurrency" {
|
|
|
|
description = "Maximum allowed in-flight (concurrent) requests per container of the revision."
|
|
|
|
type = string
|
|
|
|
default = null
|
2021-10-31 14:40:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "containers" {
|
2023-04-01 05:06:29 -07:00
|
|
|
description = "Containers in arbitrary key => attributes format."
|
|
|
|
type = map(object({
|
|
|
|
image = string
|
|
|
|
args = optional(list(string))
|
|
|
|
command = optional(list(string))
|
|
|
|
env = optional(map(string), {})
|
|
|
|
env_from_key = optional(map(object({
|
|
|
|
key = string
|
|
|
|
name = string
|
|
|
|
})), {})
|
|
|
|
liveness_probe = optional(object({
|
|
|
|
action = object({
|
|
|
|
grcp = optional(object({
|
|
|
|
port = optional(number)
|
|
|
|
service = optional(string)
|
|
|
|
}))
|
|
|
|
http_get = optional(object({
|
|
|
|
http_headers = optional(map(string), {})
|
|
|
|
path = optional(string)
|
|
|
|
}))
|
|
|
|
})
|
|
|
|
failure_threshold = optional(number)
|
|
|
|
initial_delay_seconds = optional(number)
|
|
|
|
period_seconds = optional(number)
|
|
|
|
timeout_seconds = optional(number)
|
|
|
|
}))
|
|
|
|
ports = optional(map(object({
|
|
|
|
container_port = optional(number)
|
|
|
|
name = optional(string)
|
|
|
|
protocol = optional(string)
|
|
|
|
})), {})
|
|
|
|
resources = optional(object({
|
|
|
|
limits = optional(object({
|
2021-10-31 14:40:28 -07:00
|
|
|
cpu = string
|
|
|
|
memory = string
|
2023-04-01 05:06:29 -07:00
|
|
|
}))
|
|
|
|
requests = optional(object({
|
2021-10-31 14:40:28 -07:00
|
|
|
cpu = string
|
|
|
|
memory = string
|
2023-04-01 05:06:29 -07:00
|
|
|
}))
|
|
|
|
}))
|
|
|
|
startup_probe = optional(object({
|
|
|
|
action = object({
|
|
|
|
grcp = optional(object({
|
|
|
|
port = optional(number)
|
|
|
|
service = optional(string)
|
|
|
|
}))
|
|
|
|
http_get = optional(object({
|
|
|
|
http_headers = optional(map(string), {})
|
|
|
|
path = optional(string)
|
|
|
|
}))
|
|
|
|
tcp_socket = optional(object({
|
|
|
|
port = optional(number)
|
|
|
|
}))
|
2021-10-31 14:40:28 -07:00
|
|
|
})
|
2023-04-01 05:06:29 -07:00
|
|
|
failure_threshold = optional(number)
|
|
|
|
initial_delay_seconds = optional(number)
|
|
|
|
period_seconds = optional(number)
|
|
|
|
timeout_seconds = optional(number)
|
2021-10-31 14:40:28 -07:00
|
|
|
}))
|
2023-04-01 05:06:29 -07:00
|
|
|
volume_mounts = optional(map(string), {})
|
2021-10-31 14:40:28 -07:00
|
|
|
}))
|
2023-04-01 05:06:29 -07:00
|
|
|
default = {}
|
|
|
|
nullable = false
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "eventarc_triggers" {
|
|
|
|
description = "Event arc triggers for different sources."
|
|
|
|
type = object({
|
|
|
|
audit_log = optional(map(object({
|
|
|
|
method = string
|
|
|
|
service = string
|
|
|
|
})), {})
|
2023-05-30 07:49:14 -07:00
|
|
|
pubsub = optional(map(string), {})
|
|
|
|
service_account_email = optional(string)
|
|
|
|
service_account_create = optional(bool, false)
|
2023-04-01 05:06:29 -07:00
|
|
|
})
|
|
|
|
default = {}
|
2021-10-31 14:40:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "iam" {
|
2021-11-01 11:10:06 -07:00
|
|
|
description = "IAM bindings for Cloud Run service in {ROLE => [MEMBERS]} format."
|
2021-10-31 14:40:28 -07:00
|
|
|
type = map(list(string))
|
|
|
|
default = {}
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "ingress_settings" {
|
2022-01-31 01:45:34 -08:00
|
|
|
description = "Ingress settings."
|
2021-10-31 14:40:28 -07:00
|
|
|
type = string
|
|
|
|
default = null
|
2023-06-07 10:37:46 -07:00
|
|
|
validation {
|
|
|
|
condition = contains(
|
|
|
|
["all", "internal", "internal-and-cloud-load-balancing"],
|
|
|
|
coalesce(var.ingress_settings, "all")
|
|
|
|
)
|
|
|
|
error_message = "Ingress settings can be one of 'all', 'internal', 'internal-and-cloud-load-balancing'."
|
|
|
|
}
|
2021-10-31 14:40:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "labels" {
|
2022-01-31 01:45:34 -08:00
|
|
|
description = "Resource labels."
|
2021-10-31 14:40:28 -07:00
|
|
|
type = map(string)
|
|
|
|
default = {}
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "name" {
|
2022-01-31 01:45:34 -08:00
|
|
|
description = "Name used for cloud run service."
|
2021-10-31 14:40:28 -07:00
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "prefix" {
|
|
|
|
description = "Optional prefix used for resource names."
|
|
|
|
type = string
|
|
|
|
default = null
|
2022-11-10 07:05:53 -08:00
|
|
|
validation {
|
2022-11-10 07:11:38 -08:00
|
|
|
condition = var.prefix != ""
|
2022-11-11 03:56:47 -08:00
|
|
|
error_message = "Prefix cannot be empty, please use null instead."
|
2022-11-10 07:05:53 -08:00
|
|
|
}
|
2021-10-31 14:40:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "project_id" {
|
|
|
|
description = "Project id used for all resources."
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "region" {
|
|
|
|
description = "Region used for all resources."
|
|
|
|
type = string
|
|
|
|
default = "europe-west1"
|
|
|
|
}
|
|
|
|
|
2022-08-09 05:06:30 -07:00
|
|
|
variable "revision_annotations" {
|
|
|
|
description = "Configure revision template annotations."
|
|
|
|
type = object({
|
2023-04-01 05:06:29 -07:00
|
|
|
autoscaling = optional(object({
|
2022-08-09 05:06:30 -07:00
|
|
|
max_scale = number
|
|
|
|
min_scale = number
|
2023-04-01 05:06:29 -07:00
|
|
|
}))
|
|
|
|
cloudsql_instances = optional(list(string), [])
|
|
|
|
vpcaccess_connector = optional(string)
|
|
|
|
vpcaccess_egress = optional(string)
|
2022-08-09 05:06:30 -07:00
|
|
|
})
|
2023-04-01 05:06:29 -07:00
|
|
|
default = {}
|
|
|
|
nullable = false
|
2022-08-09 05:06:30 -07:00
|
|
|
}
|
|
|
|
|
2021-10-31 14:40:28 -07:00
|
|
|
variable "revision_name" {
|
2022-01-31 01:45:34 -08:00
|
|
|
description = "Revision name."
|
2021-10-31 14:40:28 -07:00
|
|
|
type = string
|
|
|
|
default = null
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "service_account" {
|
|
|
|
description = "Service account email. Unused if service account is auto-created."
|
|
|
|
type = string
|
|
|
|
default = null
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "service_account_create" {
|
|
|
|
description = "Auto-create service account."
|
|
|
|
type = bool
|
|
|
|
default = false
|
|
|
|
}
|
|
|
|
|
2023-04-01 05:06:29 -07:00
|
|
|
variable "timeout_seconds" {
|
|
|
|
description = "Maximum duration the instance is allowed for responding to a request."
|
|
|
|
type = number
|
2021-10-31 14:40:28 -07:00
|
|
|
default = null
|
|
|
|
}
|
|
|
|
|
2023-04-01 05:06:29 -07:00
|
|
|
variable "traffic" {
|
|
|
|
description = "Traffic steering configuration. If revision name is null the latest revision will be used."
|
|
|
|
type = map(object({
|
|
|
|
percent = number
|
|
|
|
latest = optional(bool)
|
|
|
|
tag = optional(string)
|
|
|
|
}))
|
|
|
|
default = {}
|
|
|
|
nullable = false
|
|
|
|
}
|
|
|
|
|
2021-10-31 14:40:28 -07:00
|
|
|
variable "volumes" {
|
2023-04-01 05:06:29 -07:00
|
|
|
description = "Named volumes in containers in name => attributes format."
|
|
|
|
type = map(object({
|
|
|
|
secret_name = string
|
|
|
|
default_mode = optional(string)
|
|
|
|
items = optional(map(object({
|
2021-10-31 14:40:28 -07:00
|
|
|
path = string
|
2023-04-01 05:06:29 -07:00
|
|
|
mode = optional(string)
|
|
|
|
})))
|
2021-10-31 14:40:28 -07:00
|
|
|
}))
|
2023-04-01 05:06:29 -07:00
|
|
|
default = {}
|
|
|
|
nullable = false
|
2021-10-31 14:40:28 -07:00
|
|
|
}
|
|
|
|
|
2022-08-09 05:06:30 -07:00
|
|
|
variable "vpc_connector_create" {
|
|
|
|
description = "Populate this to create a VPC connector. You can then refer to it in the template annotations."
|
2021-11-03 15:48:01 -07:00
|
|
|
type = object({
|
2023-05-05 09:15:19 -07:00
|
|
|
ip_cidr_range = optional(string)
|
|
|
|
vpc_self_link = optional(string)
|
2023-04-01 05:06:29 -07:00
|
|
|
machine_type = optional(string)
|
|
|
|
name = optional(string)
|
|
|
|
instances = optional(object({
|
|
|
|
max = optional(number)
|
|
|
|
min = optional(number)
|
|
|
|
}), {})
|
|
|
|
throughput = optional(object({
|
|
|
|
max = optional(number)
|
|
|
|
min = optional(number)
|
|
|
|
}), {})
|
2023-05-05 09:15:19 -07:00
|
|
|
subnet = optional(object({
|
|
|
|
name = optional(string)
|
|
|
|
project_id = optional(string)
|
|
|
|
}), {})
|
2021-10-31 14:40:28 -07:00
|
|
|
})
|
|
|
|
default = null
|
|
|
|
}
|