forked from Young-ook/terraform-aws-eks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
labels.tf
44 lines (42 loc) · 996 Bytes
/
labels.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
resource "random_string" "uid" {
length = 12
upper = false
lower = true
number = false
special = false
}
locals {
service = "eks"
uid = join("-", [local.service, random_string.uid.result])
name = var.name == null || var.name == "" ? local.uid : var.name
default-tags = merge(
{ "terraform.io" = "managed" },
local.eks-owned-tag
)
}
## kubernetes tags
locals {
eks-shared-tag = {
format("kubernetes.io/cluster/%s", local.name) = "shared"
}
eks-owned-tag = {
format("kubernetes.io/cluster/%s", local.name) = "owned"
}
eks-elb-tag = {
"kubernetes.io/role/elb" = "1"
}
eks-internal-elb-tag = {
"kubernetes.io/role/internal-elb" = "1"
}
eks-autoscaler-tag = {
"k8s.io/cluster-autoscaler/enabled" = "true"
format("k8s.io/cluster-autoscaler/%s", local.name) = "owned"
}
eks-tag = merge(
{
"eks:cluster-name" = local.name
},
local.eks-owned-tag,
local.eks-autoscaler-tag,
)
}