forked from Young-ook/terraform-aws-eks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
outputs.tf
87 lines (77 loc) · 2.7 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
# output variables
output "cluster" {
description = "The EKS cluster attributes"
value = {
name = aws_eks_cluster.cp.name
control_plane = aws_eks_cluster.cp
data_plane = {
node_groups = local.node_groups_enabled ? aws_autoscaling_group.ng : null
managed_node_groups = local.managed_node_groups_enabled ? aws_eks_node_group.ng : null
fargate = local.fargate_enabled ? aws_eks_fargate_profile.fargate : null
}
}
}
output "role" {
description = "The generated role of the EKS node group"
value = {
node_groups = local.node_groups_enabled ? aws_iam_role.ng["enabled"] : null
managed_node_groups = local.managed_node_groups_enabled ? aws_iam_role.ng["enabled"] : null
fargate = local.fargate_enabled ? aws_iam_role.fargate["enabled"] : null
}
}
output "instance_profile" {
description = "The generated instance profile of the EKS node group"
value = {
node_groups = local.node_groups_enabled ? aws_iam_instance_profile.ng["enabled"] : null
managed_node_groups = local.managed_node_groups_enabled ? aws_iam_instance_profile.ng["enabled"] : null
fargate = local.fargate_enabled ? aws_iam_role.fargate["enabled"] : null
}
}
output "oidc" {
description = "The OIDC provider attributes for IAM Role for ServiceAccount"
value = zipmap(
["url", "arn"],
[local.oidc["url"], local.oidc["arn"]]
)
}
output "tags" {
description = "The generated tags for EKS integration"
value = {
"shared" = local.eks-shared-tag
"owned" = local.eks-owned-tag
"elb" = local.eks-elb-tag
"internal-elb" = local.eks-internal-elb-tag
}
}
data "aws_region" "current" {}
output "kubeconfig" {
description = "Bash script to update kubeconfig file"
value = join(" ", [
"bash -e",
format("%s/scripts/update-kubeconfig.sh", path.module),
format("-r %s", data.aws_region.current.name),
format("-n %s", aws_eks_cluster.cp.name),
"-k kubeconfig",
])
}
data "aws_eks_cluster_auth" "cp" {
name = aws_eks_cluster.cp.name
}
output "kubeauth" {
description = "The kubernetes cluster authentication information for Kubernetes/Helm providers"
sensitive = true
value = {
host = aws_eks_cluster.cp.endpoint
token = data.aws_eks_cluster_auth.cp.token
ca = base64decode(aws_eks_cluster.cp.certificate_authority.0.data)
}
}
output "features" {
description = "Feature configurations of EKS"
value = {
"managed_node_groups_enabled" = local.managed_node_groups_enabled
"node_groups_enabled" = local.node_groups_enabled
"fargate_enabled" = local.fargate_enabled
"ssm_enabled" = var.enable_ssm
}
}