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

add Flex instance shape support #49

Closed kral2 closed 3 years ago

kral2 commented 3 years ago

Ideally, same module should allow for provisioning both flex and non flex (shape-based) instances. Flex instance requires an additionnal shape_config block with specific parameters. See OCI provider documentation for details.

The solution needs for behave correctly with the fallback options.

Fix #42, #31

aorcl commented 3 years ago

When trying to apply with assign_public_ip=true and instance_count=2, the errors are thrown (edit: same error with instance_count=1 actually)

Error: work request did not succeed, workId: ocid1.coreservicesworkrequest.oc1.eu-frankfurt-1.abtheljtvz65owfd5dbokd5zqsgq63ur4nj72nklwhvt2eexuvp3j345qhxq, entity: instance, action: CREATED. Message: A problem occurred while preparing the instance's VNIC.  (Parameter 'availabilityDomain' does not match. VNIC has 'eu-frankfurt-1-ad-3' while the subnet has 'eu-frankfurt-1-ad-1')

  on ..\..\main.tf line 58, in resource "oci_core_instance" "this":
  58: resource "oci_core_instance" "this" {

Error: work request did not succeed, workId: ocid1.coreservicesworkrequest.oc1.eu-frankfurt-1.abtheljtcnunlsdl3iwdu7sfv3kpz23z5nmvwk7u32vussh2bznma3q7ov4a, entity: instance, action: CREATED. Message: A problem occurred while preparing the instance's VNIC.  (Parameter 'availabilityDomain' does not match. VNIC has 'eu-frankfurt-1-ad-3' while the subnet has 'eu-frankfurt-1-ad-1')

  on ..\..\main.tf line 58, in resource "oci_core_instance" "this":
  58: resource "oci_core_instance" "this" {
aorcl commented 3 years ago

the file example/instance_default/instance_default.tf refers to the module as relative path in the same repo: source = "../../"

Need to replace this with a reference to the registry.

kral2 commented 3 years ago

the file example/instance_default/instance_default.tf refers to the module as relative path in the same repo: source = "../../"

Need to replace this with a reference to the registry.

Agree, it should be changed. But this is a problem existing before and not in the scope of the current PR.

We should open a new issue for this point -> Issue #50

kral2 commented 3 years ago

Hello, The file examples/instance_default/terraform.tfvars.template and the example snippet in the file examples/instance_default/README.md are missing the initialization of the variables assign_public_ip, instance_count

Pre-existing problem and not in the scope of this PR. This should be a distinct issue -> Issue #51

kral2 commented 3 years ago

When trying to apply with assign_public_ip=true and instance_count=2, the errors are thrown (edit: same error with instance_count=1 actually)

Error: work request did not succeed, workId: ocid1.coreservicesworkrequest.oc1.eu-frankfurt-1.abtheljtvz65owfd5dbokd5zqsgq63ur4nj72nklwhvt2eexuvp3j345qhxq, entity: instance, action: CREATED. Message: A problem occurred while preparing the instance's VNIC.  (Parameter 'availabilityDomain' does not match. VNIC has 'eu-frankfurt-1-ad-3' while the subnet has 'eu-frankfurt-1-ad-1')

  on ..\..\main.tf line 58, in resource "oci_core_instance" "this":
  58: resource "oci_core_instance" "this" {

Error: work request did not succeed, workId: ocid1.coreservicesworkrequest.oc1.eu-frankfurt-1.abtheljtcnunlsdl3iwdu7sfv3kpz23z5nmvwk7u32vussh2bznma3q7ov4a, entity: instance, action: CREATED. Message: A problem occurred while preparing the instance's VNIC.  (Parameter 'availabilityDomain' does not match. VNIC has 'eu-frankfurt-1-ad-3' while the subnet has 'eu-frankfurt-1-ad-1')

  on ..\..\main.tf line 58, in resource "oci_core_instance" "this":
  58: resource "oci_core_instance" "this" {

It seems the issue is related to PR #46 Additional tests required to identify the exact conditions to reproduce the problem. My current tests successfully provision instances with count 1 to 6 all with public IPs, on regional subnets. Probably additional checks needed with ad-specific subnets -> Issue #52