Skip to content

Commit 6c81f58

Browse files
authored
Fix: instance_count + ad_number == null distributes instances per AD (#94)
when var.ad_number == null data.oci_core_shapes.current_ad cannot be created anymore. We currently rely on var.ad_number == null to provision instances in each AD in a round robin manner when var.instance_count is used. Fixes: #93
1 parent c3829cf commit 6c81f58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ data "oci_core_subnet" "instance_subnet" {
4646
// This will not check quota and limits for AD requested at resource creation
4747
data "oci_core_shapes" "current_ad" {
4848
compartment_id = var.compartment_ocid
49-
availability_domain = local.ADs[(var.ad_number - 1)]
49+
availability_domain = var.ad_number == null ? element(local.ADs, 0) : element(local.ADs, var.ad_number - 1)
5050
}
5151

5252
locals {

0 commit comments

Comments
 (0)