forked from GoogleCloudPlatform/cloud-foundation-fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
287 lines (260 loc) · 8.56 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
/**
* 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 "autoclass" {
description = "Enable autoclass to automatically transition objects to appropriate storage classes based on their access pattern. If set to true, storage_class must be set to STANDARD. Defaults to false."
type = bool
default = false
}
variable "cors" {
description = "CORS configuration for the bucket. Defaults to null."
type = object({
origin = optional(list(string))
method = optional(list(string))
response_header = optional(list(string))
max_age_seconds = optional(number)
})
default = null
}
variable "custom_placement_config" {
type = list(string)
default = null
description = "The bucket's custom location configuration, which specifies the individual regions that comprise a dual-region bucket. If the bucket is designated as REGIONAL or MULTI_REGIONAL, the parameters are empty."
}
variable "default_event_based_hold" {
description = "Enable event based hold to new objects added to specific bucket, defaults to false."
type = bool
default = null
}
variable "encryption_key" {
description = "KMS key that will be used for encryption."
type = string
default = null
}
variable "force_destroy" {
description = "Optional map to set force destroy keyed by name, defaults to false."
type = bool
default = false
}
variable "iam" {
description = "IAM bindings in {ROLE => [MEMBERS]} format."
type = map(list(string))
default = {}
}
variable "iam_bindings" {
description = "Authoritative IAM bindings in {KEY => {role = ROLE, members = [], condition = {}}}. Keys are arbitrary."
type = map(object({
members = list(string)
role = string
condition = optional(object({
expression = string
title = string
description = optional(string)
}))
}))
nullable = false
default = {}
}
variable "iam_bindings_additive" {
description = "Individual additive IAM bindings. Keys are arbitrary."
type = map(object({
member = string
role = string
condition = optional(object({
expression = string
title = string
description = optional(string)
}))
}))
nullable = false
default = {}
}
variable "labels" {
description = "Labels to be attached to all buckets."
type = map(string)
default = {}
}
variable "lifecycle_rules" {
description = "Bucket lifecycle rule."
type = map(object({
action = object({
type = string
storage_class = optional(string)
})
condition = object({
age = optional(number)
created_before = optional(string)
custom_time_before = optional(string)
days_since_custom_time = optional(number)
days_since_noncurrent_time = optional(number)
matches_prefix = optional(list(string))
matches_storage_class = optional(list(string)) # STANDARD, MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE, DURABLE_REDUCED_AVAILABILITY
matches_suffix = optional(list(string))
noncurrent_time_before = optional(string)
num_newer_versions = optional(number)
with_state = optional(string) # "LIVE", "ARCHIVED", "ANY"
})
}))
default = {}
nullable = false
validation {
condition = alltrue([
for k, v in var.lifecycle_rules : v.action != null && v.condition != null
])
error_message = "Lifecycle rules action and condition cannot be null."
}
validation {
condition = alltrue([
for k, v in var.lifecycle_rules : contains(
["Delete", "SetStorageClass", "AbortIncompleteMultipartUpload"],
v.action.type
)
])
error_message = "Lifecycle rules action type has unsupported value."
}
validation {
condition = alltrue([
for k, v in var.lifecycle_rules :
v.action.type != "SetStorageClass"
||
v.action.storage_class != null
])
error_message = "Lifecycle rules with action type SetStorageClass require a storage class."
}
}
variable "location" {
description = "Bucket location."
type = string
# default = "EU"
}
variable "logging_config" {
description = "Bucket logging configuration."
type = object({
log_bucket = string
log_object_prefix = optional(string)
})
default = null
}
variable "name" {
description = "Bucket name suffix."
type = string
}
variable "notification_config" {
description = "GCS Notification configuration."
type = object({
enabled = bool
payload_format = string
topic_name = string
sa_email = string
event_types = optional(list(string))
custom_attributes = optional(map(string))
object_name_prefix = optional(string)
})
default = null
}
variable "objects_to_upload" {
description = "Objects to be uploaded to bucket."
type = map(object({
name = string
metadata = optional(map(string))
content = optional(string)
source = optional(string)
cache_control = optional(string)
content_disposition = optional(string)
content_encoding = optional(string)
content_language = optional(string)
content_type = optional(string)
event_based_hold = optional(bool)
temporary_hold = optional(bool)
detect_md5hash = optional(string)
storage_class = optional(string)
kms_key_name = optional(string)
customer_encryption = optional(object({
encryption_algorithm = optional(string)
encryption_key = string
}))
}))
default = {}
nullable = false
}
variable "prefix" {
description = "Optional prefix used to generate the bucket name."
type = string
default = null
validation {
condition = var.prefix != ""
error_message = "Prefix cannot be empty, please use null instead."
}
}
variable "project_id" {
description = "Bucket project id."
type = string
}
variable "public_access_prevention" {
description = "Prevents public access to a bucket. Acceptable values are inherited or enforced. If inherited, the bucket uses public access prevention, only if the bucket is subject to the public access prevention organization policy constraint."
type = string
default = null
}
variable "requester_pays" {
description = "Enables Requester Pays on a storage bucket."
type = bool
default = null
}
variable "retention_policy" {
description = "Bucket retention policy."
type = object({
retention_period = number
is_locked = optional(bool)
})
default = null
}
variable "soft_delete_retention" {
description = "The duration in seconds that soft-deleted objects in the bucket will be retained and cannot be permanently deleted. Set to 0 to override the default and disable."
type = number
default = null
}
variable "storage_class" {
description = "Bucket storage class."
type = string
default = "MULTI_REGIONAL"
validation {
condition = contains(["STANDARD", "MULTI_REGIONAL", "REGIONAL", "NEARLINE", "COLDLINE", "ARCHIVE"], var.storage_class)
error_message = "Storage class must be one of STANDARD, MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE."
}
}
variable "tag_bindings" {
description = "Tag bindings for this folder, in key => tag value id format."
type = map(string)
nullable = false
default = {}
}
variable "uniform_bucket_level_access" {
description = "Allow using object ACLs (false) or not (true, this is the recommended behavior) , defaults to true (which is the recommended practice, but not the behavior of storage API)."
type = bool
default = true
}
variable "versioning" {
description = "Enable versioning, defaults to false."
type = bool
default = false
}
variable "website" {
description = "Bucket website."
type = object({
main_page_suffix = optional(string)
not_found_page = optional(string)
})
default = null
}