-
Notifications
You must be signed in to change notification settings - Fork 30
/
k8s-service-accounts.tf
83 lines (75 loc) · 2.51 KB
/
k8s-service-accounts.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
resource "kubernetes_service_account_v1" "hms_readwrite" {
count = var.hms_instance_type == "k8s" ? 1 : 0
metadata {
name = "${local.hms_alias}-readwrite"
namespace = var.metastore_namespace
annotations = {
"eks.amazonaws.com/role-arn" = var.oidc_provider == "" ? "" : aws_iam_role.apiary_hms_readwrite.arn
}
}
}
resource "kubernetes_secret_v1" "hms_readwrite" {
count = var.hms_instance_type == "k8s" ? 1 : 0
metadata {
name = "${local.hms_alias}-readwrite"
namespace = var.metastore_namespace
annotations = {
"kubernetes.io/service-account.name" ="${local.hms_alias}-readwrite"
"kubernetes.io/service-account.namespace" = var.metastore_namespace
}
}
type = "kubernetes.io/service-account-token"
depends_on = [
kubernetes_service_account_v1.hms_readwrite
]
}
resource "kubernetes_service_account_v1" "hms_readonly" {
count = var.hms_instance_type == "k8s" ? 1 : 0
metadata {
name = "${local.hms_alias}-readonly"
namespace = var.metastore_namespace
annotations = {
"eks.amazonaws.com/role-arn" = var.oidc_provider == "" ? "" : aws_iam_role.apiary_hms_readonly.arn
}
}
}
resource "kubernetes_secret_v1" "hms_readonly" {
count = var.hms_instance_type == "k8s" ? 1 : 0
metadata {
name = "${local.hms_alias}-readonly"
namespace = var.metastore_namespace
annotations = {
"kubernetes.io/service-account.name" ="${local.hms_alias}-readonly"
"kubernetes.io/service-account.namespace" = var.metastore_namespace
}
}
type = "kubernetes.io/service-account-token"
depends_on = [
kubernetes_service_account_v1.hms_readonly
]
}
resource "kubernetes_service_account_v1" "s3_inventory" {
count = var.hms_instance_type == "k8s" ? 1 : 0
metadata {
name = "${local.instance_alias}-s3-inventory"
namespace = var.metastore_namespace
annotations = {
"eks.amazonaws.com/role-arn" = var.oidc_provider == "" ? "" : aws_iam_role.apiary_s3_inventory.arn
}
}
}
resource "kubernetes_secret_v1" "s3_inventory" {
count = var.hms_instance_type == "k8s" ? 1 : 0
metadata {
name = "${local.instance_alias}-s3-inventory"
namespace = var.metastore_namespace
annotations = {
"kubernetes.io/service-account.name" ="${local.instance_alias}-s3-inventory"
"kubernetes.io/service-account.namespace" = var.metastore_namespace
}
}
type = "kubernetes.io/service-account-token"
depends_on = [
kubernetes_service_account_v1.s3_inventory
]
}