-
Notifications
You must be signed in to change notification settings - Fork 215
/
variables-iam.tf
324 lines (291 loc) · 11.6 KB
/
variables-iam.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
# Copyright (c) 2022, 2023 Oracle Corporation and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
locals {
tenancy_id = coalesce(var.tenancy_id, var.tenancy_ocid, "unknown")
compartment_id = coalesce(var.compartment_id, var.compartment_ocid, var.tenancy_id)
worker_compartment_id = coalesce(var.worker_compartment_id, var.compartment_id)
user_id = var.user_id != "" ? var.user_id : var.current_user_ocid
home_region = coalesce(var.home_region, var.region)
api_private_key = sensitive(
var.api_private_key != ""
? try(base64decode(var.api_private_key), var.api_private_key)
: var.api_private_key_path != ""
? file(var.api_private_key_path)
: null
)
# Merge freeform tags from map & individual inputs better suited to Resource Manager
bastion_freeform_tags = merge(lookup(var.freeform_tags, "bastion", {}), var.bastion_freeform_tags)
cluster_freeform_tags = merge(lookup(var.freeform_tags, "cluster", {}), var.cluster_freeform_tags)
iam_freeform_tags = merge(lookup(var.freeform_tags, "iam", {}), var.iam_freeform_tags)
network_freeform_tags = merge(lookup(var.freeform_tags, "network", {}), var.network_freeform_tags)
operator_freeform_tags = merge(lookup(var.freeform_tags, "operator", {}), var.operator_freeform_tags)
persistent_volume_freeform_tags = merge(lookup(var.freeform_tags, "persistent_volume", {}), var.persistent_volume_freeform_tags)
service_lb_freeform_tags = merge(lookup(var.freeform_tags, "service_lb", {}), var.service_lb_freeform_tags)
workers_freeform_tags = merge(lookup(var.freeform_tags, "workers", {}), var.workers_freeform_tags)
# Merge defined tags from map & individual inputs better suited to Resource Manager
bastion_defined_tags = merge(lookup(var.defined_tags, "bastion", {}), var.bastion_defined_tags)
cluster_defined_tags = merge(lookup(var.defined_tags, "cluster", {}), var.cluster_defined_tags)
iam_defined_tags = merge(lookup(var.defined_tags, "iam", {}), var.iam_defined_tags)
network_defined_tags = merge(lookup(var.defined_tags, "network", {}), var.network_defined_tags)
operator_defined_tags = merge(lookup(var.defined_tags, "operator", {}), var.operator_defined_tags)
persistent_volume_defined_tags = merge(lookup(var.defined_tags, "persistent_volume", {}), var.persistent_volume_defined_tags)
service_lb_defined_tags = merge(lookup(var.defined_tags, "service_lb", {}), var.service_lb_defined_tags)
workers_defined_tags = merge(lookup(var.defined_tags, "workers", {}), var.workers_defined_tags)
}
# Overrides Resource Manager
variable "tenancy_id" {
default = null
description = "The tenancy id of the OCI Cloud Account in which to create the resources."
type = string
}
variable "tenancy_ocid" {
default = null
description = "A tenancy OCID automatically populated by Resource Manager."
type = string
}
# Overrides Resource Manager
variable "user_id" {
default = null
description = "The id of the user that terraform will use to create the resources."
type = string
}
# Automatically populated by Resource Manager
variable "current_user_ocid" {
default = null
description = "A user OCID automatically populated by Resource Manager."
type = string
}
# Overrides Resource Manager
variable "compartment_id" {
default = null
description = "The compartment id where resources will be created."
type = string
}
# Automatically populated by Resource Manager
variable "compartment_ocid" {
default = null
description = "A compartment OCID automatically populated by Resource Manager."
type = string
}
# Overrides compartment_[oc]id
variable "worker_compartment_id" {
default = null
description = "The compartment id where worker group resources will be created."
type = string
}
variable "network_compartment_id" {
default = null
description = "The compartment id where network resources will be created."
type = string
}
# Automatically populated by Resource Manager
# List of regions: https://docs.cloud.oracle.com/iaas/Content/General/Concepts/regions.htm#ServiceAvailabilityAcrossRegions
variable "region" {
default = "us-ashburn-1"
description = "The OCI region where OKE resources will be created."
type = string
}
# List of regions: https://docs.cloud.oracle.com/iaas/Content/General/Concepts/regions.htm#ServiceAvailabilityAcrossRegions
variable "home_region" {
default = null
description = "The tenancy's home region. Required to perform identity operations."
type = string
}
variable "api_fingerprint" {
default = null
description = "Fingerprint of the API private key to use with OCI API."
type = string
}
variable "api_private_key" {
default = null
description = "The contents of the private key file to use with OCI API, optionally base64-encoded. This takes precedence over private_key_path if both are specified in the provider."
sensitive = true
type = string
}
variable "api_private_key_password" {
default = null
description = "The corresponding private key password to use with the api private key if it is encrypted."
sensitive = true
type = string
}
variable "api_private_key_path" {
default = null
description = "The path to the OCI API private key."
type = string
}
variable "config_file_profile" {
default = "DEFAULT"
description = "The profile within the OCI config file to use."
type = string
}
variable "create_iam_resources" {
default = false
description = "Whether to create IAM dynamic groups, policies, and tags. Resources for components may be controlled individually with 'create_iam_*' variables when enabled. Ignored when 'create_iam_resources' is false."
type = bool
}
variable "create_iam_autoscaler_policy" {
default = "auto"
description = "Whether to create an IAM dynamic group and policy rules for Cluster Autoscaler management. Depends on configuration of associated component when set to 'auto'. Ignored when 'create_iam_resources' is false."
type = string
validation {
condition = contains(["never", "auto", "always"], var.create_iam_autoscaler_policy)
error_message = "Accepted values are never, auto, or always"
}
}
variable "create_iam_kms_policy" {
default = "auto"
description = "Whether to create an IAM dynamic group and policy rules for cluster autoscaler. Depends on configuration of associated components when set to 'auto'. Ignored when 'create_iam_resources' is false."
type = string
validation {
condition = contains(["never", "auto", "always"], var.create_iam_kms_policy)
error_message = "Accepted values are never, auto, or always"
}
}
variable "create_iam_operator_policy" {
default = "auto"
description = "Whether to create an IAM dynamic group and policy rules for operator access to the OKE control plane. Depends on configuration of associated components when set to 'auto'. Ignored when 'create_iam_resources' is false."
type = string
validation {
condition = contains(["never", "auto", "always"], var.create_iam_operator_policy)
error_message = "Accepted values are never, auto, or always"
}
}
variable "create_iam_worker_policy" {
default = "auto"
description = "Whether to create an IAM dynamic group and policy rules for self-managed worker nodes. Depends on configuration of associated components when set to 'auto'. Ignored when 'create_iam_resources' is false."
type = string
validation {
condition = contains(["never", "auto", "always"], var.create_iam_worker_policy)
error_message = "Accepted values are never, auto, or always"
}
}
# Tagging
variable "create_iam_tag_namespace" {
default = false
description = "Whether to create a namespace for defined tags used for IAM policy and tracking. Ignored when 'create_iam_resources' is false."
type = bool
}
variable "create_iam_defined_tags" {
default = false
description = "Whether to create defined tags used for IAM policy and tracking. Ignored when 'create_iam_resources' is false."
type = bool
}
variable "use_defined_tags" {
default = false
description = "Whether to apply defined tags to created resources for IAM policy and tracking."
type = bool
}
variable "tag_namespace" {
default = "oke"
description = "The tag namespace for standard OKE defined tags."
type = string
}
variable "freeform_tags" {
default = {
bastion = {}
cluster = {}
iam = {}
network = {}
operator = {}
persistent_volume = {}
service_lb = {}
workers = {}
}
description = "Freeform tags to be applied to created resources."
type = any
}
variable "defined_tags" {
default = {
bastion = {}
cluster = {}
iam = {}
network = {}
operator = {}
persistent_volume = {}
service_lb = {}
workers = {}
}
description = "Defined tags to be applied to created resources. Must already exist in the tenancy."
type = any
}
# Individual inputs better suited to Resource Manager are merged in locals
variable "bastion_defined_tags" {
type = map(string)
description = "Defined tags applied to created resources."
default = {}
}
variable "bastion_freeform_tags" {
type = map(string)
description = "Freeform tags applied to created resources."
default = {}
}
variable "cluster_defined_tags" {
type = map(string)
description = "Defined tags applied to created resources."
default = {}
}
variable "cluster_freeform_tags" {
type = map(string)
description = "Freeform tags applied to created resources."
default = {}
}
variable "iam_defined_tags" {
type = map(string)
description = "Defined tags applied to created resources."
default = {}
}
variable "iam_freeform_tags" {
type = map(string)
description = "Freeform tags applied to created resources."
default = {}
}
variable "network_defined_tags" {
type = map(string)
description = "Defined tags applied to created resources."
default = {}
}
variable "network_freeform_tags" {
type = map(string)
description = "Freeform tags applied to created resources."
default = {}
}
variable "operator_defined_tags" {
type = map(string)
description = "Defined tags applied to created resources."
default = {}
}
variable "operator_freeform_tags" {
type = map(string)
description = "Freeform tags applied to created resources."
default = {}
}
variable "persistent_volume_defined_tags" {
type = map(string)
description = "Defined tags applied to created resources."
default = {}
}
variable "persistent_volume_freeform_tags" {
type = map(string)
description = "Freeform tags applied to created resources."
default = {}
}
variable "service_lb_defined_tags" {
type = map(string)
description = "Defined tags applied to created resources."
default = {}
}
variable "service_lb_freeform_tags" {
type = map(string)
description = "Freeform tags applied to created resources."
default = {}
}
variable "workers_defined_tags" {
type = map(string)
description = "Defined tags applied to created resources."
default = {}
}
variable "workers_freeform_tags" {
type = map(string)
description = "Freeform tags applied to created resources."
default = {}
}