Skip to content

Commit 03cb99c

Browse files
authored
fix: added workaround to create the kube to kms auth policy since IKS is not creating it automatically (#685)
1 parent 41ea0c3 commit 03cb99c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

dynamic_values/config_modules/service_authorizations/service_authorizations.tf

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ variable "atracker_cos_bucket" {
3030
description = "Add atracker to cos s2s"
3131
}
3232

33+
variable "clusters" {
34+
description = "Add cluster to kms auth policies"
35+
}
36+
3337
##############################################################################
3438

3539
##############################################################################
@@ -55,6 +59,22 @@ module "kms_to_block_storage" {
5559
]
5660
}
5761

62+
# workaround for https://github.com/terraform-ibm-modules/terraform-ibm-landing-zone/issues/645
63+
module "kube_to_kms" {
64+
source = "../list_to_map"
65+
list = [
66+
for instance in(length(var.clusters) > 0 ? ["containers-kubernetes"] : []) :
67+
{
68+
name = instance
69+
source_service_name = "containers-kubernetes"
70+
description = "Allow cluster to be encrypted by KMS instance"
71+
roles = ["Reader"]
72+
target_service_name = local.target_key_management_service
73+
target_resource_instance_id = var.key_management_guid
74+
} if local.target_key_management_service != null
75+
]
76+
}
77+
5878
##############################################################################
5979

6080
##############################################################################
@@ -134,7 +154,8 @@ output "authorizations" {
134154
module.kms_to_block_storage.value,
135155
module.cos_to_key_management.value,
136156
module.flow_logs_to_cos.value,
137-
module.atracker_to_cos.value
157+
module.atracker_to_cos.value,
158+
module.kube_to_kms.value
138159
)
139160
}
140161

dynamic_values/service_authorizations.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module "service_authorizations" {
1111
skip_kms_block_storage_s2s_auth_policy = var.skip_kms_block_storage_s2s_auth_policy
1212
skip_all_s2s_auth_policies = var.skip_all_s2s_auth_policies
1313
atracker_cos_bucket = var.atracker_cos_bucket
14+
clusters = var.clusters
1415
}
1516

1617
##############################################################################

0 commit comments

Comments
 (0)