dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.54k stars 457 forks source link

Error: missing expected [ After upgrade from provider version 0.6.10 to 0.6.11 #901

Open cyberworm54 opened 2 years ago

cyberworm54 commented 2 years ago

Linux distribution

Fedora 35

Terraform version

terraform -
v
Terraform v0.13.7
+ provider registry.terraform.io/dmacvicar/libvirt v0.6.11
+ provider registry.terraform.io/hashicorp/template v2.2.0

Provider and libvirt versions

+ provider registry.terraform.io/dmacvicar/libvirt v0.6.11

Checklist

Description of Issue/Question

provider registry.terraform.io/dmacvicar/libvirt v0.6.11 gives an error stating

Error: missing expected [

Steps to Reproduce Issue

terraform plan

Error: missing expected [

2021/11/09 04:37:31 [ERROR] eval: *terraform.EvalReadState, err: missing expected [
2021/11/09 04:37:31 [ERROR] eval: *terraform.EvalSequence, err: missing expected [
2021/11/09 04:37:31 [ERROR] eval: *terraform.EvalReadState, err: missing expected [
2021/11/09 04:37:31 [ERROR] eval: *terraform.EvalSequence, err: missing expected [
2021/11/09 04:37:31 [ERROR] eval: *terraform.EvalReadState, err: missing expected [
2021/11/09 04:37:31 [ERROR] eval: *terraform.EvalSequence, err: missing expected [

Additional information:

Do` you have SELinux or Apparmor/Firewall enabled? Some special configuration? no Have you tried to reproduce the issue without them enabled? n/a

sspreitzer commented 2 years ago

@cyberworm54

It turned out in my case, that changing the attribute type of attributes.cpu from object {} to an array of objects [{}] in the state file, solved the problem. Eg.

{
  "cpu": {"mode": "host-passthrough"}
}

To:

{
  "cpu": [ {"mode": "host-passthrough"} ]
}

This seems to be a breaking change in the state syntax, which is not converted when upgrading the provider.

Do not forget to backup your state file before you edit it.

cyberworm54 commented 2 years ago

Yep, that worked. Thank you so much for the help ! @sspreitzer

sspreitzer commented 2 years ago

@dmacvicar fyi