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

remove default value from disk scsi #690

Merged
merged 1 commit into from
Jan 16, 2020
Merged

remove default value from disk scsi #690

merged 1 commit into from
Jan 16, 2020

Conversation

rjmateus
Copy link
Contributor

Signed-off-by: Ricardo Mateus rmateus@suse.com

Linux distribution: Leap 15.1
Terraform version: Terraform v0.12.13
Provider and libvirt versions:

terraform-provider-libvirt was not built correctly
Compiled against library: libvirt 5.1.0
Using library: libvirt 5.10.0
Running hypervisor: QEMU 4.1.1
Running against daemon: 5.10.0

Provider version distributed for sumaform, but I also tested building from head (commit: db13b678ab16fe9dca024c3daea6e56fb4cc4ae2)

Terraform return an Error: Provider produced inconsistent final plan error when we have an extra disk on sumaform, using the dynamic disk block.
Full error:

Error: Provider produced inconsistent final plan

When expanding the plan for
module.server.module.suse_manager.libvirt_domain.domain[0] to include new
values learned so far during apply, provider "libvirt" produced an invalid new
value for .disk: block count changed from 1 to 2.

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

With some research, we found out that this is a problem in terraform itself. Terraform doesn't deal well with dynamic block generation when using some functions to manipulate the array of elements(like split or concat). In hashicorp/terraform#21157 the slice function is corrected, but they are probably missing the fix to the concat function.

If we remove the default value for disk scsi, the disk block don't have any value know before apply, and in this way terraform is able to handle the plan inconsistency, since all values will be known after apply.

Remove this default values doesn't look to impact in the provider execution, since after apply the value will be false also.

Reproduce

Clone this branch: https://github.com/uyuni-project/sumaform/tree/libvirt_concat_error

cp main_example_with_libvirt_error.tf main.tf
terraform init
terraform apply

Run terraform apply again and the error disappears since both disks are created and now terraform can compute the correct values.

Signed-off-by: Ricardo Mateus <rmateus@suse.com>
Copy link
Collaborator

@moio moio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This completely breaks sumaform in an upcoming refactoring PR we want to merge, so intention is to pick this patch in sumaform's terraform-provider-libvirt package in case it takes time to have it merged upstream.

Functionally, it seems not to have any side effects.

Copy link
Collaborator

@MalloZup MalloZup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx!

@MalloZup MalloZup merged commit a95fe8b into dmacvicar:master Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants