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

When regional subnets are used, the instance fails to detect the availability domain #41

Closed
aorcl opened this issue Jan 25, 2021 · 5 comments · Fixed by #46 or #47
Closed

When regional subnets are used, the instance fails to detect the availability domain #41

aorcl opened this issue Jan 25, 2021 · 5 comments · Fixed by #46 or #47

Comments

@aorcl
Copy link
Contributor

aorcl commented Jan 25, 2021

The code in main.tf relies on deriving the AD from the subnet's AD used to create the instance.
When the subnet used is of regional type, the detection fails

main.tf, line 17
availability_domain = data.oci_core_subnet.this[count.index % length(data.oci_core_subnet.this.*.availability_domain)].availability_domain

@aorcl
Copy link
Contributor Author

aorcl commented Jan 25, 2021

this results in an error when plan or apply actions are called

Error: "availability_domain": required field is not set

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

@aorcl
Copy link
Contributor Author

aorcl commented Jan 25, 2021

@kral2 - need to discuss this.
With regional subnets, there is no input element anymore in the module that could be used as source for instance's AD.
Should we add a mandatory input variable in variables.tf?
I see no other way and guessing an AD or assigning a random AD doesn't look as the right idea.

@kral2
Copy link
Contributor

kral2 commented Jan 25, 2021

There is currently lot of broken or missing features: this module needs a major overhaul.

We will probably go for a complete rewrite for v3.0.0.

@aorcl
Copy link
Contributor Author

aorcl commented Jan 26, 2021

I'll add the AD input variable in the module in the meantime, cannot release the upgraded 0.12 version without compatibility with regional subnets...

@kral2 kral2 added this to the v3.0.0 milestone Jan 26, 2021
kral2 added a commit to kral2/terraform-oci-compute-instance that referenced this issue Feb 13, 2021
add Terraform and Provider minimum versions (> 0.12)
change Block Volume default attachment type from iSCSI to paravirtualized
remove boot volume custom default value in the module

Documentation enhancement:

Requirements, Providers, Inputs and Outputs tables in README are now autogenerated
update README sample code for Terraform 0.12 syntax
add description and type to module inputs

Issue: oracle-terraform-modules#41
@kral2 kral2 linked a pull request Feb 13, 2021 that will close this issue
@kral2
Copy link
Contributor

kral2 commented Feb 13, 2021

Backporting a solution for this issue from my existing alternate compute module.
The solution uses availability domaine Data Source + a list local

adding var.ad_number, data.oci_identity_availability_domains.ad, local.ADs

User can select the desired AD giving just a number. If no number is given, instances will be provisioned in a round robin manner starting with AD 1.

Module now compatible with both regional and ad-specific subnets (no more dependency at this level).

kral2 added a commit that referenced this issue Feb 13, 2021
add Terraform and Provider minimum versions (> 0.12)
change Block Volume default attachment type from iSCSI to paravirtualized
remove boot volume custom default value in the module

Documentation enhancement:

Requirements, Providers, Inputs and Outputs tables in README are now autogenerated
update README sample code for Terraform 0.12 syntax
add description and type to module inputs

Issue: #41
@kral2 kral2 mentioned this issue Feb 13, 2021
@kral2 kral2 closed this as completed in #47 Feb 13, 2021
kral2 added a commit that referenced this issue Feb 13, 2021
add regional subnets support
add Terraform and Provider minimum versions (> 0.12)
change Block Volume default attachment type from iSCSI to paravirtualized
remove boot volume custom default value in the module

Documentation enhancement:

Requirements, Providers, Inputs and Outputs tables in README are now autogenerated
update README sample code for Terraform 0.12 syntax
add description and type to module inputs

Fix issue: #41
@kral2 kral2 removed this from the Future milestone Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants