-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathoutputs.tf
More file actions
358 lines (299 loc) · 14.1 KB
/
Copy pathoutputs.tf
File metadata and controls
358 lines (299 loc) · 14.1 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
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
356
357
358
output "unique_suffix" {
value = local.suffix
description = "Randomly generated suffix for AWS resource names, ensuring uniqueness."
}
output "kms_key_arn" {
value = length(module.kms) > 0 ? module.kms[0].key_arn : var.kms_arn
description = "ARN of the KMS key used for encrypting AWS resources."
}
output "kms_encryption_key_arn" {
value = length(module.kms) > 0 ? module.kms[0].encryption_key_arn : null
description = "ARN of the KMS key used for in-app encryption. Null if kms_arn variable is provided."
}
output "kms_signing_key_arn" {
value = length(module.kms) > 0 ? module.kms[0].jwt_key_arn : null
description = "ARN of the KMS key used for signing and verifying JWTs. Null if kms_arn variable is provided."
}
output "server_security_group_id" {
value = var.create_vpc ? module.network[0].server_security_group_id : null
description = "ID of the security group for the Spacelift HTTP server. It will be null if create_vpc is false."
}
output "drain_security_group_id" {
value = var.create_vpc ? module.network[0].drain_security_group_id : null
description = "ID of the security group for the Spacelift async-processing service. It will be null if create_vpc is false."
}
output "scheduler_security_group_id" {
value = var.create_vpc ? module.network[0].scheduler_security_group_id : null
description = "ID of the security group for the Spacelift scheduler service. It will be null if create_vpc is false."
}
output "vcs_gateway_security_group_id" {
value = var.create_vcs_gateway ? module.network[0].vcs_gateway_security_group_id : null
description = "ID of the security group for the Spacelift VCS gateway service. It will be null if create_vcs_gateway is false."
}
output "database_security_group_id" {
value = var.create_vpc ? module.network[0].database_security_group_id : null
description = "**Deprecated in favor of database_security_group_ids**. ID of the security group for the Spacelift database. It will be null if create_database is false."
}
output "database_security_group_ids" {
value = var.create_vpc ? [module.network[0].database_security_group_id] : var.rds_security_group_ids
description = "IDs of the security groups for the Spacelift database. It either returns the created security group ID if create_vpc is true, or the provided rds_security_group_ids if create_vpc is false."
}
output "private_subnet_ids" {
value = var.create_vpc ? values(module.network[0].private_subnet_ids) : null
description = "IDs of the private subnets. They will be null if create_vpc is false."
}
output "public_subnet_ids" {
value = var.create_vpc ? values(module.network[0].public_subnet_ids) : null
description = "IDs of the public subnets. They will be null if create_vpc is false."
}
output "availability_zones" {
value = var.create_vpc ? keys(module.network[0].private_subnet_ids) : null
description = "Availability zones of the private subnets. They will be null if create_vpc is false."
}
output "vpc_id" {
value = var.create_vpc ? module.network[0].vpc_id : null
description = "ID of the VPC. It will be null if create_vpc is false."
}
output "rds_cluster_identifier" {
description = "Name of the RDS cluster."
value = var.create_database ? module.rds[0].cluster_identifier : null
}
output "rds_cluster_arn" {
description = "ARN of the RDS cluster. Will be null if create_database is false."
value = var.create_database ? module.rds[0].cluster_arn : null
}
output "rds_cluster_resource_id" {
description = "Cluster resource ID of the RDS cluster. Will be null if create_database is false."
value = var.create_database ? module.rds[0].cluster_resource_id : null
}
output "rds_cluster_endpoint" {
description = "Endpoint of the RDS cluster. Will be null if create_database is false."
value = var.create_database ? module.rds[0].cluster_endpoint : null
}
output "rds_cluster_reader_endpoint" {
description = "Reader endpoint of the RDS cluster. Will be null if create_database is false."
value = var.create_database ? module.rds[0].reader_endpoint : null
}
output "rds_engine_version_actual" {
description = "Running engine version of the RDS cluster. Will be null if create_database is false."
value = var.create_database ? module.rds[0].engine_version_actual : null
}
output "rds_username" {
description = "Username for the RDS database."
value = var.rds_username
}
output "rds_password" {
description = "Password for the RDS database. Will be null if create_database is false."
value = var.create_database ? module.rds[0].db_password : null
sensitive = true
}
output "database_url" {
description = "The URL to the write endpoint of the database. Can be used to pass to the DATABASE_URL environment variable for Spacelift. Only populated if create_database is true."
value = local.database_url
sensitive = true
}
output "database_name" {
description = "Name of the database. Will be null if create_database is false."
value = var.create_database ? module.rds[0].database_name : null
}
output "database_read_only_url" {
description = "The URL to the read endpoint of the database. Can be used to pass to the DATABASE_URL environment variable for Spacelift. Only populated if create_database is true."
value = local.database_read_only_url
sensitive = true
}
output "database_secret_name" {
description = "Name of the Secrets Manager secret for the database connection string. Will be null if create_database is false."
value = var.create_database ? module.rds[0].secrets_manager_database_connection_string_name : null
}
output "database_secret_arn" {
description = "ARN of the Secrets Manager secret for the database connection string. Will be null if create_database is false."
value = var.create_database ? module.rds[0].secrets_manager_database_connection_string_arn : null
}
output "database_secret_version_id" {
description = "Version ID of the Secrets Manager secret for the database connection string. Will be null if create_database is false."
value = var.create_database ? module.rds[0].secrets_manager_database_connection_string_version_id : null
}
output "ecr_backend_repository_url" {
value = module.ecr.ecr_backend_repository_url
description = "URL of the ECR repository for the backend images."
}
output "ecr_backend_repository_arn" {
value = module.ecr.ecr_backend_repository_arn
description = "ARN of the ECR repository for the backend images."
}
output "ecr_launcher_repository_url" {
value = module.ecr.ecr_launcher_repository_url
description = "URL of the ECR repository for the launcher images."
}
output "ecr_launcher_repository_arn" {
value = module.ecr.ecr_launcher_repository_arn
description = "ARN of the ECR repository for the launcher images."
}
output "binaries_bucket_arn" {
value = module.s3.binaries_bucket_arn
description = "ARN of the S3 bucket used for storing binaries."
}
output "binaries_bucket_name" {
value = module.s3.binaries_bucket_name
description = "ID of the S3 bucket used for storing binaries."
}
output "deliveries_bucket_arn" {
value = module.s3.deliveries_bucket_arn
description = "ARN of the S3 bucket used for storing deliveries."
}
output "deliveries_bucket_name" {
value = module.s3.deliveries_bucket_name
description = "ID of the S3 bucket used for storing deliveries."
}
output "large_queue_messages_bucket_arn" {
value = module.s3.large_queue_messages_bucket_arn
description = "ARN of the S3 bucket used for storing large queue messages."
}
output "large_queue_messages_bucket_name" {
value = module.s3.large_queue_messages_bucket_name
description = "ID of the S3 bucket used for storing large queue messages."
}
output "metadata_bucket_arn" {
value = module.s3.metadata_bucket_arn
description = "ARN of the S3 bucket used for storing metadata."
}
output "metadata_bucket_name" {
value = module.s3.metadata_bucket_name
description = "ID of the S3 bucket used for storing metadata."
}
output "modules_bucket_arn" {
value = module.s3.modules_bucket_arn
description = "ARN of the S3 bucket used for storing modules."
}
output "modules_bucket_name" {
value = module.s3.modules_bucket_name
description = "ID of the S3 bucket used for storing modules."
}
output "policy_inputs_bucket_arn" {
value = module.s3.policy_inputs_bucket_arn
description = "ARN of the S3 bucket used for storing policy inputs."
}
output "policy_inputs_bucket_name" {
value = module.s3.policy_inputs_bucket_name
description = "ID of the S3 bucket used for storing policy inputs."
}
output "run_logs_bucket_arn" {
value = module.s3.run_logs_bucket_arn
description = "ARN of the S3 bucket used for storing run logs."
}
output "run_logs_bucket_name" {
value = module.s3.run_logs_bucket_name
description = "ID of the S3 bucket used for storing run logs."
}
output "states_bucket_arn" {
value = module.s3.states_bucket_arn
description = "ARN of the S3 bucket used for storing states."
}
output "states_bucket_name" {
value = module.s3.states_bucket_name
description = "ID of the S3 bucket used for storing states."
}
output "uploads_bucket_arn" {
value = module.s3.uploads_bucket_arn
description = "ARN of the S3 bucket used for storing uploads."
}
output "uploads_bucket_name" {
value = module.s3.uploads_bucket_name
description = "ID of the S3 bucket used for storing uploads."
}
data "aws_partition" "current" {}
output "uploads_bucket_url" {
value = local.uploads_bucket_url
description = "URL of the S3 bucket used for storing uploads."
}
output "user_uploaded_workspaces_bucket_arn" {
value = module.s3.user_uploaded_workspaces_bucket_arn
description = "ARN of the S3 bucket used for storing user uploaded workspaces."
}
output "user_uploaded_workspaces_bucket_name" {
value = module.s3.user_uploaded_workspaces_bucket_name
description = "ID of the S3 bucket used for storing user uploaded workspaces."
}
output "workspace_bucket_arn" {
value = module.s3.workspace_bucket_arn
description = "ARN of the S3 bucket used for storing workspaces."
}
output "workspace_bucket_name" {
value = module.s3.workspace_bucket_name
description = "ID of the S3 bucket used for storing workspaces."
}
output "sqs_queue_urls" {
description = "Map of all SQS queue URLs. Will be null if create_sqs is false."
value = var.create_sqs ? {
async_jobs = module.sqs[0].async_jobs_queue_url
async_jobs_fifo = module.sqs[0].async_jobs_fifo_queue_url
events_inbox = module.sqs[0].events_inbox_queue_url
cronjobs = module.sqs[0].cronjobs_queue_url
deadletter = module.sqs[0].deadletter_queue_url
deadletter_fifo = module.sqs[0].deadletter_fifo_queue_url
webhooks = module.sqs[0].webhooks_queue_url
iot = module.sqs[0].iot_queue_url
} : null
}
output "sqs_queue_arns" {
description = "Map of all SQS queue ARNs. Will be null if create_sqs is false."
value = var.create_sqs ? {
async_jobs = module.sqs[0].async_jobs_queue_arn
async_jobs_fifo = module.sqs[0].async_jobs_fifo_queue_arn
events_inbox = module.sqs[0].events_inbox_queue_arn
cronjobs = module.sqs[0].cronjobs_queue_arn
deadletter = module.sqs[0].deadletter_queue_arn
deadletter_fifo = module.sqs[0].deadletter_fifo_queue_arn
webhooks = module.sqs[0].webhooks_queue_arn
iot = module.sqs[0].iot_queue_arn
} : null
}
output "shell" {
value = templatefile("${path.module}/env.tftpl", {
env : {
AWS_REGION : var.region
AWS_ACCOUNT_ID : data.aws_caller_identity.current.account_id
BACKEND_IMAGE : module.ecr.ecr_backend_repository_url
LAUNCHER_IMAGE : module.ecr.ecr_launcher_repository_url
PRIVATE_ECR_LOGIN_URL : split("/", module.ecr.ecr_backend_repository_url)[0]
BINARIES_BUCKET_NAME : module.s3.binaries_bucket_name
},
})
}
output "tfvars" {
sensitive = true
value = templatefile("${path.module}/tfvars.tftpl", {
stringVars : {
aws_region : var.region
unique_suffix : local.suffix
vpc_id : var.create_vpc ? module.network[0].vpc_id : ""
server_security_group_id : var.create_vpc ? module.network[0].server_security_group_id : ""
drain_security_group_id : var.create_vpc ? module.network[0].drain_security_group_id : ""
scheduler_security_group_id : var.create_vpc ? module.network[0].scheduler_security_group_id : ""
backend_image : module.ecr.ecr_backend_repository_url
launcher_image : module.ecr.ecr_launcher_repository_url
database_url : local.database_url
database_read_only_url : local.database_read_only_url
binaries_bucket_name : module.s3.binaries_bucket_name
deliveries_bucket_name : module.s3.deliveries_bucket_name
large_queue_messages_bucket_name : module.s3.large_queue_messages_bucket_name
metadata_bucket_name : module.s3.metadata_bucket_name
modules_bucket_name : module.s3.modules_bucket_name
policy_inputs_bucket_name : module.s3.policy_inputs_bucket_name
run_logs_bucket_name : module.s3.run_logs_bucket_name
states_bucket_name : module.s3.states_bucket_name
uploads_bucket_name : module.s3.uploads_bucket_name
uploads_bucket_url : local.uploads_bucket_url
user_uploaded_workspaces_bucket_name : module.s3.user_uploaded_workspaces_bucket_name
workspace_bucket_name : module.s3.workspace_bucket_name
kms_encryption_key_arn : length(module.kms) > 0 ? module.kms[0].encryption_key_arn : ""
kms_signing_key_arn : length(module.kms) > 0 ? module.kms[0].jwt_key_arn : ""
kms_key_arn : length(module.kms) > 0 ? module.kms[0].key_arn : ""
},
jsonVars : {
public_subnet_ids : var.create_vpc ? jsonencode(values(module.network[0].public_subnet_ids)) : jsonencode([])
private_subnet_ids : var.create_vpc ? jsonencode(values(module.network[0].private_subnet_ids)) : jsonencode([])
availability_zones : var.create_vpc ? jsonencode(keys(module.network[0].private_subnet_ids)) : jsonencode([])
}
})
}