-
Notifications
You must be signed in to change notification settings - Fork 45
/
outputs.tf
executable file
·245 lines (207 loc) · 9.24 KB
/
outputs.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
# Copyright © 2021-2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
output "cluster_endpoint" {
description = "Endpoint for EKS control plane."
value = module.eks.cluster_endpoint
}
output "kube_config" {
description = "Kubernetes cluster authentication information for kubectl."
value = module.kubeconfig.kube_config
sensitive = true
}
output "cluster_iam_role_arn" {
description = "The ARN of the IAM role for the EKS cluster."
value = (module.eks.cluster_iam_role_arn == var.cluster_iam_role_arn
? false
: var.cluster_iam_role_arn
)
}
output "workers_iam_role_arn" {
description = "The ARN of the IAM role for the Node VMs."
value = var.workers_iam_role_arn
}
output "rwx_filestore_id" {
description = "The ID that identifies the file system."
value = (var.storage_type == "ha" && local.storage_type_backend == "efs"
? aws_efs_file_system.efs-fs[0].id
: var.storage_type == "ha" && local.storage_type_backend == "ontap" ? aws_fsx_ontap_file_system.ontap-fs[0].id : null)
}
output "rwx_filestore_endpoint" {
description = "The DNS name for the file system."
value = (var.storage_type == "none"
? null
: var.storage_type == "ha" && local.storage_type_backend == "efs" ? aws_efs_file_system.efs-fs[0].dns_name
: var.storage_type == "ha" && local.storage_type_backend == "ontap" ? aws_fsx_ontap_storage_virtual_machine.ontap-svm[0].endpoints[0]["nfs"][0]["dns_name"] : module.nfs[0].private_dns
)
}
output "rwx_filestore_path" {
description = "OS path used for the file system."
value = (var.storage_type == "none"
? null
: local.storage_type_backend == "efs" ? "/"
: local.storage_type_backend == "ontap" ? "/ontap" : "/export"
)
}
output "efs_arn" {
description = "Amazon Resource Name of the file system."
value = var.storage_type == "ha" && local.storage_type_backend == "efs" ? aws_efs_file_system.efs-fs[0].arn : null
}
output "jump_private_ip" {
description = "Private IP address associated with the Jump Server instance."
value = var.create_jump_vm ? module.jump[0].private_ip_address : null
}
output "jump_public_ip" {
description = "Public IP address associated with the Jump Server instance."
value = var.create_jump_vm ? module.jump[0].public_ip_address : null
}
output "jump_admin_username" {
description = "Admin username for the Jump Server instance."
value = var.create_jump_vm ? module.jump[0].admin_username : null
}
output "jump_private_dns" {
description = "Private DNS name assigned to the Jump Server instance."
value = var.create_jump_vm ? module.jump[0].private_dns : null
}
output "jump_public_dns" {
description = "Public DNS name assigned to the Jump Server instance."
value = var.create_jump_vm ? module.jump[0].public_dns : null
}
output "jump_rwx_filestore_path" {
description = "OS path used in cloud-init for NFS integration."
value = (var.storage_type != "none"
? var.create_jump_vm ? var.jump_rwx_filestore_path : null
: null
)
}
output "nfs_private_ip" {
description = "Private IP address associated with the NFS Server instance."
value = var.storage_type == "standard" ? module.nfs[0].private_ip_address : null
}
output "nfs_public_ip" {
description = "Public IP address associated with the NFS Server instance."
value = var.storage_type == "standard" ? module.nfs[0].public_ip_address : null
}
output "nfs_admin_username" {
description = "Admin username for the NFS Server instance."
value = var.storage_type == "standard" ? module.nfs[0].admin_username : null
}
output "nfs_private_dns" {
description = "Private DNS name assigned to the NFS Server instance."
value = var.storage_type == "standard" ? module.nfs[0].private_dns : null
}
output "nfs_public_dns" {
description = "Public DNS name assigned to the NFS Server instance."
value = var.storage_type == "standard" ? module.nfs[0].public_dns : null
}
#postgres
output "postgres_servers" {
description = "Map of PostgreSQL server objects."
value = length(module.postgresql) != 0 ? local.postgres_outputs : null
sensitive = true
}
output "nat_ip" {
description = "List of public Elastic IPs created for AWS NAT Gateway."
value = module.vpc.create_nat_gateway ? module.vpc.nat_public_ips[0] : null
}
output "prefix" {
description = "The prefix used in the name for all cloud resources created by this script."
value = var.prefix
}
output "cluster_name" {
description = "EKS cluster name."
value = local.cluster_name
}
output "provider" {
description = "Public cloud provider infrastructure components are deployed for."
value = "aws"
}
output "location" {
description = "AWS Region where all resources in this script were provisioned."
value = var.location
}
## Reference for Amazon ECR private registries: https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html
output "cr_endpoint" {
description = "The default private registry URL."
value = "https://${data.aws_caller_identity.terraform.account_id}.dkr.ecr.${var.location}.amazonaws.com"
}
output "cluster_node_pool_mode" {
description = "Cluster node configuration."
value = var.cluster_node_pool_mode
}
output "autoscaler_account" {
description = "ARN of IAM role for cluster-autoscaler."
value = var.autoscaling_enabled ? module.autoscaling[0].autoscaler_account : null
}
output "cluster_api_mode" {
description = "Use Public or Private IP address for the cluster API endpoint."
value = var.cluster_api_mode
}
output "ebs_csi_account" {
description = "ARN of IAM role for ebs-csi-controller Service Account."
value = module.ebs.ebs_csi_account
}
output "k8s_version" {
description = "Kubernetes master version."
value = module.eks.cluster_version
}
output "aws_shared_credentials_file" {
description = "Path to shared AWS credentials file"
value = var.aws_shared_credentials_file
precondition {
condition = var.aws_shared_credentials_file != null
error_message = "aws_shared_credentials_file must not be null. aws_shared_credentials_file has been deprecated and will be removed in a future release, use aws_shared_credentials_files instead."
}
}
output "aws_shared_credentials" {
description = "Path to shared AWS credentials file"
value = local.aws_shared_credentials
precondition {
condition = length(var.aws_shared_credentials_file) == 0 || var.aws_shared_credentials_files == null
error_message = "Set either aws_shared_credentials_files or aws_shared_credentials_file, but not both. aws_shared_credentials_file is deprecated and will be removed in a future release, use aws_shared_credentials_files instead."
}
}
output "storage_type_backend" {
description = "The storage backend employed for the chosen storage_type."
value = local.storage_type_backend != null ? local.storage_type_backend : null
precondition {
condition = (var.storage_type == "standard" && var.storage_type_backend == "nfs"
|| var.storage_type == "ha" && var.storage_type_backend == "nfs"
|| var.storage_type == "ha" && var.storage_type_backend == "efs"
|| var.storage_type == "ha" && var.storage_type_backend == "ontap"
|| var.storage_type == "none" && var.storage_type_backend == "none")
error_message = "nfs is the only valid storage_type_backend when storage_type == 'standard'"
}
}
output "aws_fsx_ontap_fsxadmin_password" {
description = "The ONTAP administrative password for the fsxadmin user."
value = (local.storage_type_backend == "ontap" ? var.aws_fsx_ontap_fsxadmin_password : null)
sensitive = true
}
output "byo_network_scenario" {
description = "BYON Scenario Number"
value = module.vpc.byon_scenario
}
output "validate_subnet_azs" {
description = "Validation for user inputted subnet_azs"
# validation, no output value needed
value = null
precondition {
# Validation Notes:
# Either the user does not define subnet_azs and it defaults to {}, in which case the whole map will be populated
# If the user does not define a specific key, that is allowed and we will populate the az list for that subnet
# Lastly, if the user does define a specific subnet_azs key, it must be greater than or equal to the matching subnet map list
condition = (var.subnet_azs == {} ||
(
(length(lookup(var.subnet_azs, "private", [])) == 0 || length(lookup(var.subnet_azs, "private", [])) >= length(lookup(var.subnets, "private", []))) &&
(length(lookup(var.subnet_azs, "control_plane", [])) == 0 || length(lookup(var.subnet_azs, "control_plane", [])) >= length(lookup(var.subnets, "control_plane", []))) &&
(length(lookup(var.subnet_azs, "public", [])) == 0 || length(lookup(var.subnet_azs, "public", [])) >= length(lookup(var.subnets, "public", []))) &&
(length(lookup(var.subnet_azs, "database", [])) == 0 || length(lookup(var.subnet_azs, "database", [])) >= length(lookup(var.subnets, "database", [])))
)
)
error_message = "Your subnet_azs keys must have a string list value of AZs greater than or equal to the list of CIDRs in equivalent key in the subnets variable."
}
}
output "enable_nist_features" {
description = "Flag to enable NIST features."
value = var.enable_nist_features
}