Skip to content
This repository was archived by the owner on Aug 12, 2024. It is now read-only.

Commit 09a957a

Browse files
author
Sean Sundberg
authored
Exposes kms_enabled variable to explicitly set instead of deriving (#19)
Signed-off-by: Sean Sundberg <[email protected]>
1 parent f89549d commit 09a957a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ locals {
4545
vpc_subnets = !var.exists ? var.vpc_subnets : []
4646
security_group_id = !var.exists ? data.ibm_is_vpc.vpc[0].default_security_group : ""
4747
ipv4_cidr_blocks = !var.exists ? data.ibm_is_subnet.vpc_subnet[*].ipv4_cidr_block : []
48-
kms_enabled = var.kms_key_id != ""
49-
kms_config = local.kms_enabled ? [{
48+
kms_config = var.kms_enabled ? [{
5049
instance_id = var.kms_id
5150
crk_id = var.kms_key_id
5251
private_endpoint = var.kms_private_endpoint
@@ -127,7 +126,7 @@ data ibm_is_subnet vpc_subnet {
127126
}
128127

129128
resource "ibm_iam_authorization_policy" "policy" {
130-
count = local.kms_enabled && var.authorize_kms ? length(local.policy_targets) : 0
129+
count = var.kms_enabled && var.authorize_kms ? length(local.policy_targets) : 0
131130

132131
source_service_name = "containers-kubernetes"
133132
target_service_name = local.policy_targets[count.index]

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ variable "cos_id" {
9595
description = "The crn of the COS instance that will be used with the OCP instance"
9696
}
9797

98+
variable "kms_enabled" {
99+
type = bool
100+
description = "Flag indicating that kms encryption should be enabled for this cluster"
101+
default = false
102+
}
103+
98104
variable "kms_id" {
99105
type = string
100106
description = "The crn of the KMS instance that will be used to encrypt the cluster."

0 commit comments

Comments
 (0)