-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvariables.tf
More file actions
210 lines (197 loc) · 7.06 KB
/
Copy pathvariables.tf
File metadata and controls
210 lines (197 loc) · 7.06 KB
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
########################################################################################################################
# Input Variables
########################################################################################################################
variable "resource_group_id" {
description = "ID of the resource group to use when creating resources."
type = string
}
variable "ibmcloud_api_key" {
type = string
description = "The IBM Cloud API key. Required only when 'builds' are specified and used."
sensitive = true
default = null
# ibmcloud_api_key must be set only when var.builds is not empty to run the "build run"
validation {
condition = length(var.builds) == 0 || var.ibmcloud_api_key != null
error_message = "The 'ibmcloud_api_key' must be set if 'builds' is not empty to run the build process."
}
validation {
condition = (var.ibmcloud_api_key == null || length(var.builds) > 0)
error_message = "If 'ibmcloud_api_key' is set, 'builds' must not be empty."
}
}
variable "project_name" {
description = "The name of the project to which code engine resources will be added. It is required if var.existing_project_id is null."
type = string
default = null
validation {
condition = (var.project_name != null) != (var.existing_project_id != null)
error_message = "Please provide exactly one of var.project_name or var.existing_project_id. Passing neither or both is invalid."
}
}
variable "existing_project_id" {
description = "The ID of the existing project to which code engine resources will be added. It is required if var.project_name is null."
type = string
default = null
}
variable "apps" {
description = "A map of code engine apps to be created."
type = map(object({
image_reference = string
image_secret = optional(string)
run_env_variables = optional(list(object({
type = optional(string)
name = optional(string)
value = optional(string)
prefix = optional(string)
key = optional(string)
reference = optional(string)
})))
run_volume_mounts = optional(list(object({
mount_path = string
reference = string
type = string
})))
image_port = optional(number)
managed_domain_mappings = optional(string)
run_arguments = optional(list(string))
run_as_user = optional(number)
run_commands = optional(list(string))
run_service_account = optional(string)
scale_concurrency = optional(number)
scale_concurrency_target = optional(number)
scale_cpu_limit = optional(string)
scale_ephemeral_storage_limit = optional(string)
scale_initial_instances = optional(number)
scale_max_instances = optional(number)
scale_memory_limit = optional(string)
scale_min_instances = optional(number)
scale_request_timeout = optional(number)
scale_down_delay = optional(number)
}))
default = {}
}
variable "jobs" {
description = "A map of code engine jobs to be created."
type = map(object({
image_reference = string
image_secret = optional(string)
run_env_variables = optional(list(object({
type = optional(string)
name = optional(string)
value = optional(string)
prefix = optional(string)
key = optional(string)
reference = optional(string)
})))
run_volume_mounts = optional(list(object({
mount_path = string
reference = string
type = string
})))
run_arguments = optional(list(string))
run_as_user = optional(number)
run_commands = optional(list(string))
run_mode = optional(string)
run_service_account = optional(string)
scale_array_spec = optional(string)
scale_cpu_limit = optional(string)
scale_ephemeral_storage_limit = optional(string)
scale_max_execution_time = optional(number)
scale_memory_limit = optional(string)
scale_retry_limit = optional(number)
}))
default = {}
}
variable "config_maps" {
description = "A map of code engine config maps to be created."
type = map(object({
data = map(string)
}))
default = {}
}
variable "secrets" {
description = "A map of code engine secrets to be created."
type = map(object({
format = string
data = map(string)
# Issue with provider, service_access is not supported at the moment. https://github.com/IBM-Cloud/terraform-provider-ibm/issues/5232
# service_access = optional(list(object({
# resource_key = list(object({
# id = optional(string)
# }))
# role = list(object({
# crn = optional(string)
# }))
# service_instance = list(object({
# id = optional(string)
# }))
# })))
}))
default = {}
}
variable "builds" {
description = "A map of code engine builds to be created. Requires 'ibmcloud_api_key' to be set for authentication and execution."
type = map(object({
output_image = optional(string)
output_secret = optional(string) # pragma: allowlist secret
source_url = string
strategy_type = optional(string)
source_context_dir = optional(string)
source_revision = optional(string)
source_secret = optional(string)
source_type = optional(string)
strategy_size = optional(string)
strategy_spec_file = optional(string)
timeout = optional(number)
region = optional(string)
container_registry_namespace = optional(string)
prefix = optional(string)
}))
default = {}
}
variable "domain_mappings" {
description = "A map of code engine domain mappings to be created."
type = map(object({
tls_secret = string # pragma: allowlist secret
components = list(object({
name = string
resource_type = string
}))
}))
default = {}
}
variable "bindings" {
description = "A map of code engine bindings to be created."
type = map(object({
secret_name = string
components = list(object({
name = string
resource_type = string
}))
}))
default = {}
}
variable "cbr_rules" {
type = list(object({
description = string
account_id = string
rule_contexts = list(object({
attributes = optional(list(object({
name = string
value = string
}))) }))
enforcement_mode = string
operations = optional(list(object({
api_types = list(object({
api_type_id = string
}))
})))
}))
description = "The context-based restrictions rule to create. Only one rule is allowed."
default = []
validation {
condition = length(var.cbr_rules) <= 1
error_message = "Only one CBR rule is allowed."
}
}