Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instance creation fails when using count and ad-specific subnets #52

Closed
kral2 opened this issue Feb 18, 2021 · 1 comment
Closed

Instance creation fails when using count and ad-specific subnets #52

kral2 opened this issue Feb 18, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@kral2
Copy link
Contributor

kral2 commented Feb 18, 2021

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.

Originally posted by @kral2 in #49 (comment)

@kral2 kral2 added the bug Something isn't working label Feb 18, 2021
@kral2 kral2 self-assigned this Mar 5, 2021
@kral2
Copy link
Contributor Author

kral2 commented Mar 18, 2021

@aorcl I reproduced the issue. It is due to how instance_count and ad-specific subnets are implemented in the current version of the module.

isolating the repro conditions

  • you are using ad-specific subnets (regional subnets are not affected by this bug),
  • length(var.subnet_ocids) < 3 && length(var.subnet_ocids) < var.instance_count

recommendations

With the current instance_count implementation, the recommentations are the following:

  1. use regional subnets whenever it is possible
  2. when using ad-specific subnets and var.instance_count together, try to always declare as many subnets as the region have Availability Domains. In this situation, instances will always get affected a valid subnet ocid related to the ad they are affected.
  3. If you cannot provision one ad-specific subnet per ad region, you cannot provision instances count greater than the number of ad specific subnets in the same module.

Long term plan

Plan is to probably deprecate var.instance_count in a future release or go through a major refactoring.

There is better ways to handle multiple instances creation at once today than it was possible two years ago, using either Terraform new capabilities or OCI API new capabilities.

Some options:

Let me know if if works for you.

@kral2 kral2 changed the title Instance creation fails with using count and assing_public_ip Instance creation fails when using count and ad-specific subnets Mar 18, 2021
@kral2 kral2 closed this as completed Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant