oracle-terraform-modules / terraform-oci-compute-instance

Terraform Module for creating Oracle Cloud Infrastructure compute instances
https://registry.terraform.io/modules/oracle-terraform-modules/compute-instance/oci/latest
Other
46 stars 62 forks source link

fix: build the shape list on the current AD #88

Closed snafuz closed 2 years ago

snafuz commented 2 years ago

close #87

The list of shapes is now built on the given availability domain

Signed-off-by: Andrea Marchesini andrea.marchesini@oracle.com

kral2 commented 2 years ago

I guess you will have to amend & force push after configuring a gpg key for your git client, before we can merge. https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification

kral2 commented 2 years ago

this PR introduce a bug when var.ad_number == null data.oci_core_shapes.current_ad cannot be created anymore as local.ADs[(var.ad_number - 1)] generates an error when trying to do an arithmetic operation using null.

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.

I propose to restore the old behavior for when var.ad_number is set to null and keep the new behavior (checking shapes on the actual requested AD) when an AD number is specified:

data "oci_core_shapes" "current_ad" {
  compartment_id      = var.compartment_ocid
  availability_domain  = var.ad_number == null ? element(local.ADs, 0) : element(local.ADs, var.ad_number - 1)
}

In the current state, the repo's HEAD is breaking a feature that we rely uppon and cannot be released.