Skip to content

Commit

Permalink
Fix: instance_count + ad_number == null distributes instances per AD (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
kral2 authored Jan 29, 2022
1 parent c3829cf commit 6c81f58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ data "oci_core_subnet" "instance_subnet" {
// This will not check quota and limits for AD requested at resource creation
data "oci_core_shapes" "current_ad" {
compartment_id = var.compartment_ocid
availability_domain = local.ADs[(var.ad_number - 1)]
availability_domain = var.ad_number == null ? element(local.ADs, 0) : element(local.ADs, var.ad_number - 1)
}

locals {
Expand Down

0 comments on commit 6c81f58

Please sign in to comment.