Skip to content

Commit df9730e

Browse files
ddevadathyder
authored andcommitted
feat: Ability to customize block volume for instance-pool
Added the ability to customize block volume creation when worker pool mode is instance-pool Signed-off-by: Deepak Devadathan <[email protected]>
1 parent a5cdd82 commit df9730e

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

examples/workers/vars-workers-instancepool.auto.tfvars

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,18 @@ worker_pools = {
1919
mode = "instance-pool",
2020
size = 1,
2121
burst = "BASELINE_1_8", # Valid values BASELINE_1_8,BASELINE_1_2
22-
}
22+
},
23+
oke-vm-instance-pool-with-block-volume = {
24+
description = "Self-managed Instance Pool with block volume",
25+
mode = "instance-pool",
26+
size = 1,
27+
disable_block_volume = false,
28+
block_volume_size_in_gbs = 60,
29+
},
30+
oke-vm-instance-pool-without-block-volume = {
31+
description = "Self-managed Instance Pool without block volume",
32+
mode = "instance-pool",
33+
size = 1,
34+
disable_block_volume = true,
35+
},
2336
}

modules/workers/instanceconfig.tf

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,22 @@ resource "oci_core_instance_configuration" "workers" {
117117
is_pv_encryption_in_transit_enabled = each.value.pv_transit_encryption
118118
}
119119

120-
block_volumes {
121-
attach_details {
122-
type = each.value.block_volume_type
123-
is_pv_encryption_in_transit_enabled = each.value.pv_transit_encryption
124-
}
120+
dynamic "block_volumes" {
121+
for_each = (lookup(each.value, "disable_block_volume", false) != true) ? [1] : []
122+
content {
123+
attach_details {
124+
type = each.value.block_volume_type
125+
is_pv_encryption_in_transit_enabled = each.value.pv_transit_encryption
126+
}
125127

126-
create_details {
127-
// Limit to first candidate placement AD for cluster-network; undefined for all otherwise
128-
availability_domain = each.value.mode == "cluster-network" ? element(each.value.availability_domains, 1) : null
129-
compartment_id = each.value.compartment_id
130-
display_name = each.key
131-
kms_key_id = each.value.volume_kms_key_id
128+
create_details {
129+
// Limit to first candidate placement AD for cluster-network; undefined for all otherwise
130+
availability_domain = each.value.mode == "cluster-network" ? element(each.value.availability_domains, 1) : null
131+
compartment_id = each.value.compartment_id
132+
display_name = each.key
133+
kms_key_id = each.value.volume_kms_key_id
134+
size_in_gbs = max(50, lookup(each.value, "block_volume_size_in_gbs", 50))
135+
}
132136
}
133137
}
134138

0 commit comments

Comments
 (0)