-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvariables.tf
355 lines (273 loc) · 9.28 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# The project id to use, to which a random suffix will be appended to avoid
# collision in the global namespace.
variable "project_id" {
type = "string"
description = <<EOF
REQUIRED.
The project id to use for this project; a random suffix will be added to the
value to avoid collision with an existing project_id, and the resulting string
will be truncated to 30 chars max. The value must match /[a-z][-a-z0-9]+/.
E.g. project_id = "foo-bar" will become something like
generated project_id = "foo-bar-213e2a3c"
EOF
}
# Set to true to disable project randomisation - useful when importing existing
# projects into the module.
variable "randomise_project_id" {
description = <<EOF
If set to false, the project_id will not contain a random suffix; defaults to
true. E.g. to import an existing project into terraform workspace using this
module,
randomise_project_id = false
EOF
default = true
}
# The project display name to use. This can contain any characters.
variable "display_name" {
type = "string"
description = <<EOF
The display name to use for the project. Default is an empty string.
EOF
default = ""
}
# The domain name associated with the organization
variable "org_domain_name" {
type = "string"
description = <<EOF
REQUIRED.
The domain name associated with the organization into which this project will
be inserted. E.g. neudesic.com
EOF
}
# The billing account name
variable "org_billing_name" {
type = "string"
description = <<EOF
REQUIRED.
The display name of the billing account to associate with this project. This
can be found in consule UI for billing, or by executing
`gcloud beta billing accounts list --format='value(displayName)'`
EOF
}
# Folder id; Terraform does not have an easy way to find a nested folder id
# from a name, so request the unique folder id.
variable "folder_id" {
type = "string"
description = <<EOF
If not empty, the project will be created within the folder that is uniquely
identified by this value. Defaults to '' to create project in root of
organization.
EOF
default = ""
}
variable "is_shared_vpc_host" {
description = <<EOF
If set to true, the project will be created as a shared VPC host project.
Defaults to false.
EOF
default = false
}
variable "shared_vpc_host_project_id" {
type = "string"
description = <<EOF
If `shared_vpc_host_project_id` is not empty and a valid project identifier,
the new project will be created as a shared VPC service project, attached to
the host specified by this value.
EOF
default = ""
}
variable "networks" {
type = "list"
description = <<EOF
A list of network names to create in the project, defaults to an empty list.
EOF
default = []
}
variable "subnets" {
type = "list"
description = <<EOF
A list of network:region:CIDR (or network:region:CIDR:name:enable_private)
definitions to use for creating subnetworks. If a name for the subnet is not
provided, one will be generated by concatenating network name and region, separated by hyphens. An optional `enable_private` flag can be used to
enable/disable private IP access on the subnet; the flag defaults to false.
E.g. subnets = ["prod:us-west1:192.168.0.0/24:dmz", "prod:us-east1:192.168.1.0/24"]
will create two subnets in `prod` network, in us-west1 and us-east1, with CIDRs
192.168.0.0/24 and 192.168.1.0/24 respectively. The name of the subnet in
us-west1 will be 'dmz', and us-east1 will be `prod-us-east1` as there wasn't a
specific name provided.
EOF
default = []
}
variable "network_admins" {
type = "list"
description = <<EOF
A list of accounts (service account, user, or group) that will be granted the
compute.networkAdmin role on shared VPC host projects. Default is an empty
list.
E.g. network_admins = [
"serviceAccount:[email protected]",
"user:[email protected]",
"group:[email protected]"
]
EOF
default = []
}
variable "network_users" {
type = "list"
description = <<EOF
A list of accounts (service account, user, or group) that will be granted the
compute.networkUser role on shared VPC host projects. Default is an empty list.
E.g. networkUusers = [
"serviceAccount:[email protected]",
"user:[email protected]",
"group:[email protected]"
]
EOF
default = []
}
variable "service_account_ids" {
type = "list"
description = <<EOF
An optional list of service account id's to create in the the project.
Defaults to an empty list.
E.g. service_account_id = ["foobar", "baz"] in project "abc-foo" will create
service accounts with emails [email protected]
and [email protected].
EOF
default = []
}
variable "service_account_subnets" {
type = "list"
description = <<EOF
A mapping of service accounts (email addresses) to subnets for which the
service account will be allowed to connect. Defaults to an empty list, which
allows all service accounts created from `service_account_ids` variable to
have access to all subnets in host (or this) project.
The subnets *must* be specified as a list of region:name pairs, as terraform
must provide a region as part of the association to service account. You can
get the list of region:pairs in a host project created by these series of
modules by getting the output of 'subnets' from the host project workspace.
E.g.
service_account_subnets = [] =>
all service accounts can bind to any subnet of the service host project
service_account_subnets = [ "[email protected]:us-west1:bar"] =>
service account 'foobar' can only bind to 'bar' subnet in region 'us-west1'
of network as defined in the service host project. Any other service accounts
will not have permissions to join a network.
EOF
default = []
}
variable "service_account_subnets_count" {
default = 0
description = <<EOF
When passing a list of service account:subnets as part of a shared VPC, you must explicitly set the number of entries in the list to work around a Terraform limitation.
E.g.
service_account_subnets = ["[email protected]:us-west1:bar"]
service_account_subnets_count = 1
EOF
}
variable "iam_assignments" {
type = "list"
description = <<EOF
A list of accounts (service account, user, or group) that will be granted a
named role on project. List is formatted as account=role. Defaults to an empty
list.
E.g. iam_assigments = [
"serviceAccount:[email protected]=roles/editor",
"user:[email protected]=roles/viewer",
"group:[email protected]=roles/owner"
]
EOF
default = []
}
variable "iam_assignments_count" {
default = 0
description = <<EOF
When passing a list of account:roles as `iam_assignments`, you must explicitly set the number of entries in the list to work around a Terraform limitation.
E.g.
iam_assignments = ["user:[email protected]=roles/editor"]
iam_assignments_count = 1
EOF
}
# A list of APIs to enable on the project
variable "enable_apis" {
type = "list"
description = <<EOF
A list of APIs to enable in the project. Defaults to an empty list.
E.g. enable_apis = ["container.googleapis.com"] to enable use of GKE.
EOF
default = []
}
# Delete default service account?
variable "delete_default_service_account" {
type = "string"
description = <<EOF
If true, the default service account will be deleted during project creation.
Defaults to true, as this is the recommendation of Neudesic.
EOF
default = "true"
}
# Should the default network be deleted when the project is created
variable "auto_create_network" {
type = "string"
description = <<EOF
If set to false, which is the recommended and default value, the 'default'
network will be destroyed as part of project creation. If set to true, the
'default' network will remain as part of project creation.
Default value is false.
EOF
default = "false"
}
# If set to a valid bucket name, usage data will be exported to it as
# CSV files. Recommended, but optional.
variable "usage_export_bucket" {
type = "string"
description = <<EOF
The name of a bucket to use for usage reporting. Daily and monthly
usage reports for the project will be exported as CSV files into
this bucket, in a folder named 'usage-project_id'. If left empty,
then a project bucket will be automatically created and used for usage exports.
Default value is an empty string.
E.g.
project_id = "foobar"
usage_export_bucket = "billing_data"
will result in daily CSVs being stored as
'gs://billing_data/usage-foobar-XXXXXX_gcs_YYYYMMDD.csv'
project_id = "foobar"
usage_export_bucket = "" (default)
will result in daily CSVs being stored as
'gs://foobar-XXXXXX/usage-foobar-XXXXXX_gcs_YYYYMMDD.csv'
EOF
default = ""
}
# Location to use when automatically creating a usage export bucket for the
# project
variable "usage_export_bucket_location" {
type = "string"
description = <<EOF
The location to use if a bucket is automatically created to contain usage
export files for the project. Must be one of the supported multi-regional
buckets ('ASIA', 'EU', or 'US' at time of writing). Default is 'US'.
EOF
default = "US"
}
# Service account credentials
variable "terraform_credentials" {
type = "string"
description = <<EOF
File that contains the terraform service account credentials for supporting
scripts. Default is an empty string.
EOF
default = ""
}
variable "labels" {
type = "map"
default = {}
description = <<EOF
A map of key-value pairs to attach as labels to all resources that accept them. Default is an empty set.
E.g. to label all resources with 'customer' value,
labels = {
"customer" = "name"
}
EOF
}