-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptional.tf
241 lines (223 loc) · 6.47 KB
/
optional.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
variable "name" {
description = "Name to use for the bucket. If null, will default to product."
default = null
type = string
}
variable "use_prefix" {
description = "Create bucket with prefix instead of explicit name"
default = true
type = bool
}
variable "is_versioned" {
description = "Is versioning enabled?"
default = true
type = bool
}
variable "acl" {
description = "ACL configuration for the bucket. If an ACL is not provided, the bucket will be created with ACLs disabled"
default = null
type = object({
canned_acl = optional(string)
expected_bucket_owner = optional(string)
access_control_policy = optional(object({
grants = set(object({
grantee = object({
type = string
email_address = optional(string)
id = optional(string)
uri = optional(string)
})
permission = string
}))
owner = object({
id = string
display_name = optional(string)
})
}))
})
validation {
condition = var.acl == null || !(try(var.acl.canned_acl, null) != null && try(var.acl.access_control_policy, null) != null)
error_message = "Only one of canned_acl or access_control_policy can be set"
}
}
variable "force_destroy" {
description = "Allow destruction of an S3 bucket without clearing out the contents first"
default = false
type = bool
}
variable "cors_rules" {
description = "CORS Rules"
default = []
type = set(object({
allowed_headers = list(string),
allowed_methods = list(string),
allowed_origins = list(string),
expose_headers = list(string),
max_age_seconds = number
}))
}
variable "lifecycle_rules" {
description = "List of maps containing configuration of object lifecycle management."
type = list(object({
id = string
enabled = optional(bool, true)
filter = optional(object({
and = optional(list(object({
object_size_greater_than = optional(number)
object_size_less_than = optional(number)
prefix = optional(string)
tags = optional(map(string))
})))
object_size_greater_than = optional(number)
object_size_less_than = optional(number)
prefix = optional(string)
tag = optional(object({
key = string
value = string
}))
}))
abort_incomplete_multipart_upload_days = optional(number)
expiration = optional(object({
date = optional(string)
days = optional(number)
expired_object_delete_marker = optional(bool)
}))
noncurrent_version_expiration = optional(object({
days = optional(number)
}))
noncurrent_version_transition = optional(list(object({
days = optional(number)
storage_class = optional(string)
})), [])
transition = optional(list(object({
date = optional(string)
days = optional(number)
storage_class = string
})), [])
}))
default = [{
id = "default-lifecycle-rule",
enabled = true,
abort_incomplete_multipart_upload_days = 7,
transition = [
{
days = 7,
storage_class = "INTELLIGENT_TIERING",
}
]
noncurrent_version_transition = [
{
days = 30,
storage_class = "GLACIER",
}
]
}]
# Example:
#
# lifecycle_rules = [
# {
# id = "log"
# enabled = true
#
# prefix = "log/"
#
# tags = {
# "rule" = "log"
# "autoclean" = "true"
# }
#
# transition = [
# {
# days = 30
# storage_class = "STANDARD_IA" # or "ONEZONE_IA"
# },
# {
# days = 60
# storage_class = "GLACIER"
# }
# ]
#
# expiration = {
# days = 90
# }
# }
# ]
}
variable "replication_configuration_set" {
description = "Set of (single) replication that needs to be managed by this bucket. If empty, no replication takes place."
default = []
type = set(object({
role = string,
rules = set(object({
id = string
priority = number
status = string
destination_account_id = string
destination_bucket = string
destination_access_control_translation_owner = string
}))
}))
}
variable "replication_configuration_shortcut" {
description = "Shorthand version of the configuration used in replication_configuration_set. Is overridden by replication_configuration_set if defined."
default = null
type = object({
destination_account_id = string
destination_bucket = string
})
}
variable "create_bucket_policy" {
description = "Create a bucket policy for the bucket"
default = true
type = bool
}
variable "block_public_acls" {
description = "Whether Amazon S3 should block public ACLs for this bucket."
default = true
type = bool
}
variable "block_public_policy" {
description = "Whether Amazon S3 should block public bucket policies for this bucket."
default = true
type = bool
}
variable "ignore_public_acls" {
description = "Whether Amazon S3 should ignore public ACLs for this bucket."
default = true
type = bool
}
variable "restrict_public_buckets" {
description = "Whether Amazon S3 should restrict public bucket policies for this bucket."
default = true
type = bool
}
variable "inventory_config" {
description = "Inventory configuration"
default = null
type = object({
enabled = optional(bool, true)
included_object_versions = optional(string, "All")
destination = object({
bucket = object({
name = string
format = optional(string, "Parquet")
prefix = optional(string)
account_id = optional(string)
})
})
filter = optional(object({
prefix = string
}))
schedule = optional(object({
frequency = string
}), {
frequency = "Daily"
})
optional_fields = optional(list(string), [
"Size",
"LastModifiedDate",
"StorageClass",
"IntelligentTieringAccessTier",
])
})
}