Skip to content

Commit

Permalink
feat: Ability to customize block volume for instance-pool
Browse files Browse the repository at this point in the history
Added the ability to customize block volume creation when worker pool mode is instance-pool

Signed-off-by: Deepak Devadathan <[email protected]>
  • Loading branch information
ddevadat authored and hyder committed Dec 18, 2024
1 parent a5cdd82 commit df9730e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
15 changes: 14 additions & 1 deletion examples/workers/vars-workers-instancepool.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,18 @@ worker_pools = {
mode = "instance-pool",
size = 1,
burst = "BASELINE_1_8", # Valid values BASELINE_1_8,BASELINE_1_2
}
},
oke-vm-instance-pool-with-block-volume = {
description = "Self-managed Instance Pool with block volume",
mode = "instance-pool",
size = 1,
disable_block_volume = false,
block_volume_size_in_gbs = 60,
},
oke-vm-instance-pool-without-block-volume = {
description = "Self-managed Instance Pool without block volume",
mode = "instance-pool",
size = 1,
disable_block_volume = true,
},
}
26 changes: 15 additions & 11 deletions modules/workers/instanceconfig.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,22 @@ resource "oci_core_instance_configuration" "workers" {
is_pv_encryption_in_transit_enabled = each.value.pv_transit_encryption
}

block_volumes {
attach_details {
type = each.value.block_volume_type
is_pv_encryption_in_transit_enabled = each.value.pv_transit_encryption
}
dynamic "block_volumes" {
for_each = (lookup(each.value, "disable_block_volume", false) != true) ? [1] : []
content {
attach_details {
type = each.value.block_volume_type
is_pv_encryption_in_transit_enabled = each.value.pv_transit_encryption
}

create_details {
// Limit to first candidate placement AD for cluster-network; undefined for all otherwise
availability_domain = each.value.mode == "cluster-network" ? element(each.value.availability_domains, 1) : null
compartment_id = each.value.compartment_id
display_name = each.key
kms_key_id = each.value.volume_kms_key_id
create_details {
// Limit to first candidate placement AD for cluster-network; undefined for all otherwise
availability_domain = each.value.mode == "cluster-network" ? element(each.value.availability_domains, 1) : null
compartment_id = each.value.compartment_id
display_name = each.key
kms_key_id = each.value.volume_kms_key_id
size_in_gbs = max(50, lookup(each.value, "block_volume_size_in_gbs", 50))
}
}
}

Expand Down

0 comments on commit df9730e

Please sign in to comment.