vatesfr / terraform-provider-xenorchestra

Xen Orchestra provider for Terraform
MIT License
151 stars 32 forks source link

Destroy issue for cloud configs #204

Closed 4censord closed 2 years ago

4censord commented 2 years ago

seems like the same issue as #196 and #199

xenorchestra_cloud_config.user_data: Creating...
╷
│ Error: json: cannot unmarshal object into Go value of type bool
│ 
│   with xenorchestra_cloud_config.user_data,
│   on main.tf line 48, in resource "xenorchestra_cloud_config" "user_data":
│   48: resource "xenorchestra_cloud_config" "user_data" {
│ 
╵

only happens on xoa latest, does not happen on stable

ddelnano commented 2 years ago

Hey @4censord, thanks for reporting this. When you say latest, can you give me a more specific version or commit sha? Looking at the recent commits to the repo, I don't see the offending change so knowing more specifically about when it was introduced will narrow down the number of commits to sort through.

4censord commented 2 years ago

Sorry, yes I really wasn't clear about versions and reproducability

I am running

#terraform --version
Terraform v1.2.3
on linux_amd64

and terraform-provider-xenorchestra version v0.23.2

Running this terraform config:

terraform {
  required_providers {
    xenorchestra = {
      source  = "terra-farm/xenorchestra"
      version = "=0.23.2"
    }
  }
}

resource "xenorchestra_cloud_config" "demo" {
  name = "cloud config name"
  template = <<EOF
#cloud-config

runcmd:
 - [ ls, -l, / ]
 - [ sh, -xc, "echo $(date) ': hello world!'" ]
 - [ sh, -c, echo "=========hello world'=========" ]
 - ls -l /root
EOF
}

Running this against xoa on the stable channel works flawlessly.
Versions copied from xoa:

But against xoa on the latest channel fails with

#terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # xenorchestra_cloud_config.demo will be created
  + resource "xenorchestra_cloud_config" "demo" {
      + id       = (known after apply)
      + name     = "cloud config name"
      + template = <<-EOT
            #cloud-config

            runcmd:
             - [ ls, -l, / ]
             - [ sh, -xc, "echo $(date) ': hello world!'" ]
             - [ sh, -c, echo "=========hello world'=========" ]
             - ls -l /root
        EOT
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

xenorchestra_cloud_config.demo: Creating...
╷
│ Error: json: cannot unmarshal object into Go value of type bool
│ 
│   with xenorchestra_cloud_config.demo,
│   on data.tf line 10, in resource "xenorchestra_cloud_config" "demo":
│   10: resource "xenorchestra_cloud_config" "demo" {
│ 
╵

The xoa reports the following version:

When changing channels to stable again, everything works as expected again.

Terraform log with debug logging: ## Lock file ```tf # This file is maintained automatically by "terraform init". # Manual edits may be lost in future updates. provider "registry.terraform.io/terra-farm/xenorchestra" { version = "0.23.2" constraints = "0.23.2" hashes = [ "h1:R+Z8dXHqDFXtUJeSU9LFQMMqc0O4qakxhE3uHyu4Jog=", "zh:2f2e448a628161bc9e0cceae928ffce57641c44e6e0edc34404556cfb29694ab", "zh:3a0956b5fb4eeb7399067cd2f41e3d238ff17b9a56115c51835100b9c37fe770", "zh:51f90aa4b8f50f30147b6c4a9a3716c0951d0eae524936b8180f0089a561563f", "zh:af1e77c477b173547e321ca5970ba260deec91104cd8a82f78a3a3f03ecf9282", "zh:bd53f6385f05194b9b9ea400c9967c612987768af46b65fab92dd976581fd67e", "zh:ce979dc105a41dd3ffd847986306ef1d332e6ac9f14c1969295b750dcab6b3f3", "zh:ef55712a48b19684e9a17173b2d522ade54c7547b655936f62bdba298aea5d0c", ] } ``` ## Log ```shell #TF_LOG=DEBUG terraform apply -auto-approve 2022-07-06T15:00:36.784+0200 [INFO] Terraform version: 1.2.3 2022-07-06T15:00:36.784+0200 [DEBUG] using github.com/hashicorp/go-tfe v1.0.0 2022-07-06T15:00:36.784+0200 [DEBUG] using github.com/hashicorp/hcl/v2 v2.12.0 2022-07-06T15:00:36.784+0200 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2 2022-07-06T15:00:36.784+0200 [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 2022-07-06T15:00:36.784+0200 [DEBUG] using github.com/zclconf/go-cty v1.10.0 2022-07-06T15:00:36.784+0200 [INFO] Go runtime version: go1.18.3 2022-07-06T15:00:36.784+0200 [INFO] CLI args: []string{"terraform", "apply", "-auto-approve"} 2022-07-06T15:00:36.784+0200 [DEBUG] Attempting to open CLI config file: /home/daniel/.terraformrc 2022-07-06T15:00:36.784+0200 [INFO] Loading CLI configuration from /home/daniel/.terraformrc 2022-07-06T15:00:36.784+0200 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins 2022-07-06T15:00:36.784+0200 [DEBUG] ignoring non-existing provider search directory /home/daniel/.terraform.d/plugins 2022-07-06T15:00:36.784+0200 [DEBUG] ignoring non-existing provider search directory /home/daniel/.local/share/terraform/plugins 2022-07-06T15:00:36.784+0200 [DEBUG] ignoring non-existing provider search directory /var/lib/flatpak/exports/share/terraform/plugins 2022-07-06T15:00:36.784+0200 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins 2022-07-06T15:00:36.784+0200 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins 2022-07-06T15:00:36.784+0200 [INFO] CLI command args: []string{"apply", "-auto-approve"} 2022-07-06T15:00:36.785+0200 [DEBUG] New state was assigned lineage "025008e4-e7b3-4565-6b93-f0d89ea87de5" 2022-07-06T15:00:36.826+0200 [DEBUG] checking for provisioner in "." 2022-07-06T15:00:36.834+0200 [DEBUG] checking for provisioner in "/usr/bin" 2022-07-06T15:00:36.834+0200 [INFO] backend/local: starting Apply operation 2022-07-06T15:00:36.835+0200 [DEBUG] created provider logger: level=debug 2022-07-06T15:00:36.835+0200 [INFO] provider: configuring client automatic mTLS 2022-07-06T15:00:36.850+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 args=[.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2] 2022-07-06T15:00:36.850+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 pid=14103 2022-07-06T15:00:36.850+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 2022-07-06T15:00:36.857+0200 [INFO] provider.terraform-provider-xenorchestra_v0.23.2: configuring server automatic mTLS: timestamp=2022-07-06T15:00:36.856+0200 2022-07-06T15:00:36.886+0200 [DEBUG] provider.terraform-provider-xenorchestra_v0.23.2: plugin address: address=/tmp/plugin326567803 network=unix timestamp=2022-07-06T15:00:36.886+0200 2022-07-06T15:00:36.886+0200 [DEBUG] provider: using plugin: version=5 2022-07-06T15:00:36.914+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing" 2022-07-06T15:00:36.915+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 pid=14103 2022-07-06T15:00:36.915+0200 [DEBUG] provider: plugin exited 2022-07-06T15:00:36.915+0200 [DEBUG] Building and walking validate graph 2022-07-06T15:00:36.915+0200 [DEBUG] ProviderTransformer: "xenorchestra_cloud_config.demo" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/terra-farm/xenorchestra"] 2022-07-06T15:00:36.915+0200 [DEBUG] ReferenceTransformer: "xenorchestra_cloud_config.demo" references: [] 2022-07-06T15:00:36.915+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/terra-farm/xenorchestra\"]" references: [] 2022-07-06T15:00:36.915+0200 [DEBUG] Starting graph walk: walkValidate 2022-07-06T15:00:36.915+0200 [DEBUG] created provider logger: level=debug 2022-07-06T15:00:36.915+0200 [INFO] provider: configuring client automatic mTLS 2022-07-06T15:00:36.931+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 args=[.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2] 2022-07-06T15:00:36.931+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 pid=14116 2022-07-06T15:00:36.931+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 2022-07-06T15:00:36.937+0200 [INFO] provider.terraform-provider-xenorchestra_v0.23.2: configuring server automatic mTLS: timestamp=2022-07-06T15:00:36.937+0200 2022-07-06T15:00:36.964+0200 [DEBUG] provider.terraform-provider-xenorchestra_v0.23.2: plugin address: address=/tmp/plugin408588680 network=unix timestamp=2022-07-06T15:00:36.964+0200 2022-07-06T15:00:36.964+0200 [DEBUG] provider: using plugin: version=5 2022-07-06T15:00:36.994+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing" 2022-07-06T15:00:36.996+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 pid=14116 2022-07-06T15:00:36.996+0200 [DEBUG] provider: plugin exited 2022-07-06T15:00:36.996+0200 [INFO] backend/local: apply calling Plan 2022-07-06T15:00:36.996+0200 [DEBUG] Building and walking plan graph for NormalMode 2022-07-06T15:00:36.996+0200 [DEBUG] ProviderTransformer: "xenorchestra_cloud_config.demo (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/terra-farm/xenorchestra"] 2022-07-06T15:00:36.996+0200 [DEBUG] ReferenceTransformer: "xenorchestra_cloud_config.demo (expand)" references: [] 2022-07-06T15:00:36.996+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/terra-farm/xenorchestra\"]" references: [] 2022-07-06T15:00:36.996+0200 [DEBUG] Starting graph walk: walkPlan 2022-07-06T15:00:36.996+0200 [DEBUG] created provider logger: level=debug 2022-07-06T15:00:36.996+0200 [INFO] provider: configuring client automatic mTLS 2022-07-06T15:00:37.013+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 args=[.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2] 2022-07-06T15:00:37.013+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 pid=14129 2022-07-06T15:00:37.013+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 2022-07-06T15:00:37.019+0200 [INFO] provider.terraform-provider-xenorchestra_v0.23.2: configuring server automatic mTLS: timestamp=2022-07-06T15:00:37.019+0200 2022-07-06T15:00:37.047+0200 [DEBUG] provider: using plugin: version=5 2022-07-06T15:00:37.047+0200 [DEBUG] provider.terraform-provider-xenorchestra_v0.23.2: plugin address: address=/tmp/plugin987140481 network=unix timestamp=2022-07-06T15:00:37.047+0200 2022-07-06T15:00:37.076+0200 [WARN] ValidateProviderConfig from "provider[\"registry.terraform.io/terra-farm/xenorchestra\"]" changed the config value, but that value is unused 2022-07-06T15:00:37.134+0200 [DEBUG] Resource instance state not found for node "xenorchestra_cloud_config.demo", instance xenorchestra_cloud_config.demo 2022-07-06T15:00:37.134+0200 [DEBUG] ReferenceTransformer: "xenorchestra_cloud_config.demo" references: [] 2022-07-06T15:00:37.135+0200 [DEBUG] refresh: xenorchestra_cloud_config.demo: no state, so not refreshing 2022-07-06T15:00:37.137+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing" 2022-07-06T15:00:37.138+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 pid=14129 2022-07-06T15:00:37.138+0200 [DEBUG] provider: plugin exited 2022-07-06T15:00:37.138+0200 [DEBUG] building apply graph to check for errors 2022-07-06T15:00:37.138+0200 [DEBUG] Resource state not found for node "xenorchestra_cloud_config.demo", instance xenorchestra_cloud_config.demo 2022-07-06T15:00:37.139+0200 [DEBUG] ProviderTransformer: "xenorchestra_cloud_config.demo (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/terra-farm/xenorchestra"] 2022-07-06T15:00:37.139+0200 [DEBUG] ProviderTransformer: "xenorchestra_cloud_config.demo" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/terra-farm/xenorchestra"] 2022-07-06T15:00:37.139+0200 [DEBUG] ReferenceTransformer: "xenorchestra_cloud_config.demo (expand)" references: [] 2022-07-06T15:00:37.139+0200 [DEBUG] ReferenceTransformer: "xenorchestra_cloud_config.demo" references: [] 2022-07-06T15:00:37.139+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/terra-farm/xenorchestra\"]" references: [] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # xenorchestra_cloud_config.demo will be created + resource "xenorchestra_cloud_config" "demo" { + id = (known after apply) + name = "cloud config name" + template = <<-EOT #cloud-config runcmd: - [ ls, -l, / ] - [ sh, -xc, "echo $(date) ': hello world!'" ] - [ sh, -c, echo "=========hello world'=========" ] - ls -l /root EOT } Plan: 1 to add, 0 to change, 0 to destroy. 2022-07-06T15:00:37.139+0200 [INFO] backend/local: apply calling Apply 2022-07-06T15:00:37.139+0200 [DEBUG] Building and walking apply graph for NormalMode plan 2022-07-06T15:00:37.139+0200 [DEBUG] Resource state not found for node "xenorchestra_cloud_config.demo", instance xenorchestra_cloud_config.demo 2022-07-06T15:00:37.139+0200 [DEBUG] ProviderTransformer: "xenorchestra_cloud_config.demo (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/terra-farm/xenorchestra"] 2022-07-06T15:00:37.139+0200 [DEBUG] ProviderTransformer: "xenorchestra_cloud_config.demo" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/terra-farm/xenorchestra"] 2022-07-06T15:00:37.139+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/terra-farm/xenorchestra\"]" references: [] 2022-07-06T15:00:37.139+0200 [DEBUG] ReferenceTransformer: "xenorchestra_cloud_config.demo (expand)" references: [] 2022-07-06T15:00:37.139+0200 [DEBUG] ReferenceTransformer: "xenorchestra_cloud_config.demo" references: [] 2022-07-06T15:00:37.140+0200 [DEBUG] Starting graph walk: walkApply 2022-07-06T15:00:37.140+0200 [DEBUG] created provider logger: level=debug 2022-07-06T15:00:37.140+0200 [INFO] provider: configuring client automatic mTLS 2022-07-06T15:00:37.154+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 args=[.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2] 2022-07-06T15:00:37.154+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 pid=14142 2022-07-06T15:00:37.154+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 2022-07-06T15:00:37.161+0200 [INFO] provider.terraform-provider-xenorchestra_v0.23.2: configuring server automatic mTLS: timestamp=2022-07-06T15:00:37.161+0200 2022-07-06T15:00:37.187+0200 [DEBUG] provider.terraform-provider-xenorchestra_v0.23.2: plugin address: address=/tmp/plugin021989181 network=unix timestamp=2022-07-06T15:00:37.187+0200 2022-07-06T15:00:37.187+0200 [DEBUG] provider: using plugin: version=5 2022-07-06T15:00:37.222+0200 [WARN] ValidateProviderConfig from "provider[\"registry.terraform.io/terra-farm/xenorchestra\"]" changed the config value, but that value is unused xenorchestra_cloud_config.demo: Creating... 2022-07-06T15:00:37.284+0200 [INFO] Starting apply for xenorchestra_cloud_config.demo 2022-07-06T15:00:37.284+0200 [DEBUG] xenorchestra_cloud_config.demo: applying the planned Create change 2022-07-06T15:00:37.286+0200 [INFO] provider.terraform-provider-xenorchestra_v0.23.2: 2022/07/06 15:00:37 [TRACE] Made rpc call `cloudConfig.create` with params: map[name:cloud config name template:#cloud-config runcmd: - [ ls, -l, / ] - [ sh, -xc, "echo $(date) ': hello world!'" ] - [ sh, -c, echo "=========hello world'=========" ] - ls -l /root ] and received false: result with error: json: cannot unmarshal object into Go value of type bool: timestamp=2022-07-06T15:00:37.286+0200 2022-07-06T15:00:37.287+0200 [ERROR] vertex "xenorchestra_cloud_config.demo" error: json: cannot unmarshal object into Go value of type bool ╷ │ Error: json: cannot unmarshal object into Go value of type bool │ │ with xenorchestra_cloud_config.demo, │ on data.tf line 10, in resource "xenorchestra_cloud_config" "demo": │ 10: resource "xenorchestra_cloud_config" "demo" { │ ╵ 2022-07-06T15:00:37.288+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing" 2022-07-06T15:00:37.289+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.2/linux_amd64/terraform-provider-xenorchestra_v0.23.2 pid=14142 2022-07-06T15:00:37.289+0200 [DEBUG] provider: plugin exited ```
ddelnano commented 2 years ago

This will be released in v0.23.3. I hope to release that sometime this week.