-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvariabes.tf
190 lines (171 loc) · 5.68 KB
/
variabes.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
variable "project_id" {
type = string
validation {
condition = can(regex("^[a-z][a-z0-9-]{4,28}[a-z0-9]$", var.project_id))
error_message = "The project_id must be a string of alphanumeric or hyphens, between 6 and 3o characters in length."
}
description = <<EOD
The GCP project identifier where the function will be created.
EOD
}
variable "function_path" {
type = string
description = "The (relative) path where the source code for the function can be found. Must point to a directory."
}
variable "runtime" {
type = string
description = "The runtime in which to run the function."
validation {
condition = contains([
"nodejs20",
"nodejs18",
"nodejs16",
"nodejs14",
"nodejs12",
"nodejs10",
"python312",
"python311",
"python310",
"python39",
"python38",
"python37",
"go121",
"go120",
"go119",
"go118",
"go116",
"go113",
"go111",
"java17",
"java11",
"dotnet6",
"dotnet3",
"ruby32",
"ruby30",
"ruby27",
"ruby26",
"php82",
"php81",
"php74"], var.runtime)
error_message = "Must be a valid runtime. See https://cloud.google.com/functions/docs/concepts/execution-environment for a list of valid runtimes."
}
}
variable "region" {
type = string
description = "The location (region) in which the function will be deployed."
}
variable "min_instance_count" {
type = number
default = 0
description = "The limit on the minimum number of function instances that may coexist at a given time."
}
variable "timeout_seconds" {
type = number
default = 60
description = "The function execution timeout. Execution is considered failed and can be terminated if the function is not completed at the end of the timeout period. Defaults to 60 seconds."
}
variable "available_memory" {
type = string
default = "128Mi"
description = "The amount of memory available for a function. Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is supplied the value is interpreted as bytes."
}
variable "available_cpu" {
type = string
default = "4"
description = "The amount of CPU available for a function."
}
variable "all_traffic_on_latest_revision" {
type = bool
default = true
description = "Whether 100% of traffic is routed to the latest revision. Defaults to true."
}
variable "entry_point" {
type = string
description = <<EOD
The name of the function (as defined in source code) that will be executed.
Defaults to the resource name suffix, if not specified.
For backward compatibility, if function with given name is not found, then the system will try to use function named "function".
For Node.js this is name of a function exported by the module specified in source_location.
EOD
}
variable "environment_variables" {
type = map(string)
default = {}
description = "User-provided build-time environment variables for the function."
}
variable "max_instance_count" {
type = number
default = 1
description = "The limit on the maximum number of function instances that may coexist at a given time."
}
variable "function_name" {
type = string
validation {
condition = can(regex("^[a-zA-Z0-9_-]{1,255}$", var.function_name))
error_message = "The function_name must be a string of alphanumeric, hyphen, and underscore characters, and upto 255 characters in length."
}
description = <<EOD
The function name.
EOD
}
variable "ingress_settings" {
type = string
validation {
condition = contains(["ALLOW_ALL", "ALLOW_INTERNAL_ONLY", "ALLOW_INTERNAL_AND_GCLB"], var.ingress_settings)
error_message = "Must be one of ALLOW_ALL, ALLOW_INTERNAL_ONLY, ALLOW_INTERNAL_AND_GCLB"
}
description = "Available ingress settings. Defaults to ALLOW_ALL if unspecified. Default value is ALLOW_ALL. Possible values are ALLOW_ALL, ALLOW_INTERNAL_ONLY, and ALLOW_INTERNAL_AND_GCLB."
default = "ALLOW_ALL"
}
variable "roles" {
type = list(string)
validation {
condition = alltrue([
for role in var.roles: can(regex("^roles/[a-zA-Z.]+$", role))
])
error_message = "Must be a role qualifier, starting with roles/. For example: roles/datastore.user"
}
description = "The list of roles to assign to the service account that the Cloud Function will use."
default = []
}
variable "invokers" {
type = list(string)
description = "The list of members that can invoke the function. Include allUsers to make the function public."
default = ["allUsers"]
}
variable "vpc_connector" {
type = string
description = <<EOD
The Serverless VPC Access connector that this cloud function can connect to.
This should be a fully qualified URI in this format: projects/*/locations/*/connectors/*.
EOD
default = null
}
variable "vpc_connector_egress_settings" {
type = string
validation {
condition = (
var.vpc_connector_egress_settings == null ? true : (
contains(["ALL_TRAFFIC", "PRIVATE_RANGES_ONLY"], var.vpc_connector_egress_settings)
)
)
error_message = "Must be one of ALL_TRAFFIC, PRIVATE_RANGES_ONLY"
}
description = <<EOD
The egress settings for the VPC connector. This controls which traffic flows through it.
Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY
EOD
default = null
}
variable "new_pubsub_topics" {
type = list(string)
validation {
condition = alltrue([
for topic in var.new_pubsub_topics :
can(regex("^[a-zA-Z0-9_-]{1,255}$", topic))
])
error_message = "Each topic name must be a string of alphanumeric, hyphen, and underscore characters, and up to 255 characters in length."
}
description = "The name of the Pub/Sub topic to which messages will be published. Default is to create no topic."
default = []
}