Skip to content

Commit a0a3d04

Browse files
authored
fix: Added policies for nodepool boot volume and block volume encryption (#461)
Signed-off-by: Srinivasa Nikhil Kota <srinivasa.nikhil.kota@oracle.com>
1 parent 0920a67 commit a0a3d04

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

modules/oke/iam.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ resource "oci_identity_policy" "oke_kms" {
3434
statements = [local.policy_statement]
3535
count = var.use_encryption == true ? 1 : 0
3636
}
37+
38+
resource "oci_identity_policy" "oke_volume_kms" {
39+
provider = oci.home
40+
compartment_id = var.compartment_id
41+
description = "Policies for block volumes to access kms key"
42+
name = var.label_prefix == "none" ? "oke-volume-kms" : "${var.label_prefix}-oke-volume-kms"
43+
statements = local.oke_volume_kms_policy_statements
44+
count = var.node_pool_volume_kms_key_id == "" ? 0 : 1
45+
}

modules/oke/locals.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ locals {
1717
# policy to allow dynamic group of all clusters to use kms
1818
policy_statement = (var.use_encryption == true) ? "Allow dynamic-group ${oci_identity_dynamic_group.oke_kms_cluster[0].name} to use keys in compartment id ${var.compartment_id} where target.key.id = '${var.kms_key_id}'" : ""
1919

20+
# policy to allow block volumes inside oke to use kms
21+
oke_volume_kms_policy_statements = [
22+
"Allow service oke to use key-delegates in compartment id ${var.compartment_id} where target.key.id = '${var.node_pool_volume_kms_key_id}'",
23+
"Allow service blockstorage to use keys in compartment id ${var.compartment_id} where target.key.id = '${var.node_pool_volume_kms_key_id}'"
24+
]
25+
2026
# 1. get a list of available images for this cluster
2127
# 2. filter by version
2228
# 3. if more than 1 image found for this version, pick the latest

0 commit comments

Comments
 (0)