-
Notifications
You must be signed in to change notification settings - Fork 883
/
variables.tf
170 lines (153 loc) · 5.29 KB
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**
* Copyright 2023 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 "addresses" {
description = "Optional IP addresses to be used for Secure Web Proxy."
type = list(string)
default = null
}
variable "certificates" {
description = "List of certificates to be used for Secure Web Proxy."
type = list(string)
}
variable "delete_swg_autogen_router_on_destroy" {
description = "Delete automatically provisioned Cloud Router on destroy."
type = bool
default = true
}
variable "description" {
description = "Optional description for the created resources."
type = string
default = "Managed by Terraform."
}
variable "labels" {
description = "Resource labels."
type = map(string)
default = {}
}
variable "name" {
description = "Name of the Secure Web Proxy resource."
type = string
}
variable "network" {
description = "Name of the network the Secure Web Proxy is deployed into."
type = string
}
variable "policy_rules" {
description = "List of policy rule definitions, default to allow action. Available keys: secure_tags, url_lists, custom. URL lists that only have values set will be created."
type = object({
secure_tags = optional(map(object({
tag = string
session_matcher = optional(string)
application_matcher = optional(string)
priority = number
action = optional(string, "ALLOW")
enabled = optional(bool, true)
tls_inspection_enabled = optional(bool, false)
description = optional(string)
})), {})
url_lists = optional(map(object({
url_list = string
values = optional(list(string))
session_matcher = optional(string)
application_matcher = optional(string)
priority = number
action = optional(string, "ALLOW")
enabled = optional(bool, true)
tls_inspection_enabled = optional(bool, false)
description = optional(string)
})), {})
custom = optional(map(object({
session_matcher = optional(string)
application_matcher = optional(string)
priority = number
action = optional(string, "ALLOW")
enabled = optional(bool, true)
tls_inspection_enabled = optional(bool, false)
description = optional(string)
})), {})
})
validation {
condition = (
length(concat(
[for k, v in var.policy_rules.secure_tags : v.priority],
[for k, v in var.policy_rules.url_lists : v.priority],
[for k, v in var.policy_rules.custom : v.priority])) ==
length(distinct(concat(
[for k, v in var.policy_rules.secure_tags : v.priority],
[for k, v in var.policy_rules.url_lists : v.priority],
[for k, v in var.policy_rules.custom : v.priority])))
)
error_message = "Each rule must have unique priority."
}
default = {}
nullable = false
}
variable "ports" {
description = "Ports to use for Secure Web Proxy."
type = list(number)
default = [443]
}
variable "project_id" {
description = "Project id of the project that holds the network."
type = string
}
variable "region" {
description = "Region where resources will be created."
type = string
}
variable "scope" {
description = "Scope determines how configuration across multiple Gateway instances are merged."
type = string
default = null
}
variable "service_attachment" {
description = "PSC service attachment configuration."
type = object({
nat_subnets = list(string)
automatic_connection = optional(bool, false)
consumer_accept_lists = optional(map(string), {})
consumer_reject_lists = optional(list(string))
description = optional(string)
domain_name = optional(string)
enable_proxy_protocol = optional(bool, false)
reconcile_connections = optional(bool)
})
default = null
}
variable "subnetwork" {
description = "Name of the subnetwork the Secure Web Proxy is deployed into."
type = string
}
variable "tls_inspection_config" {
description = "TLS inspection configuration."
type = object({
create_config = optional(object({
ca_pool = optional(string, null)
description = optional(string, null)
exclude_public_ca_set = optional(bool, false)
}), null)
id = optional(string, null)
})
nullable = false
default = {}
validation {
condition = !(
var.tls_inspection_config.create_config != null &&
var.tls_inspection_config.id != null
)
error_message = "You can't assign values both to `create.config.ca_pool` and `id`."
}
}