OpenNebula / terraform-provider-opennebula

Terraform provider for OpenNebula
https://www.terraform.io/docs/providers/opennebula/
Mozilla Public License 2.0
63 stars 52 forks source link

When attempting to create a Ceph datastore of type "IMAGE", the following error occurs: #552

Open tikondrus opened 4 months ago

tikondrus commented 4 months ago

Description

` │ Error: Plugin did not respond │ │ with module.one.opennebula_datastore.opennebula_datastore_image, │ on modules/opennebula/main.tf line 47, in resource "opennebula_datastore" "opennebula_datastore_image": │ 47: resource "opennebula_datastore" "opennebula_datastore_image" { │ │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details. ╵

Stack trace from the terraform-provider-opennebula_v1.4.0 plugin:

panic: interface conversion: interface {} is string, not schema.Setgoroutine 155 [running]: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(MapFieldWriter).setSet(0x14000616318, {0x14000305240, 0x1, 0x1}, {0x104eb9180, 0x14000305230}, 0x140004a1400) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/field_writer_map.go:343 +0x69c github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(MapFieldWriter).set(0x14000616318, {0x14000305240, 0x1, 0x1}, {0x104eb9180, 0x14000305230}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/field_writer_map.go:107 +0x124 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(MapFieldWriter).WriteField(0x14000616318, {0x14000305240, 0x1, 0x1}, {0x104eb9180, 0x14000305230}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/field_writer_map.go:89 +0x390 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(ResourceData).Set(0x14000798000, {0x104d0bd3e, 0x1b}, {0x104eb9180, 0x14000305230}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource_data.go:227 +0x20c github.com/OpenNebula/terraform-provider-opennebula/opennebula.resourceOpennebulaDatastoreRead({0x14000798000?, 0x1400061096a?}, 0x14000798000, {0x104ee1c00, 0x1400053e100}) github.com/OpenNebula/terraform-provider-opennebula/opennebula/resource_opennebula_datastore.go:543 +0x7e4 github.com/OpenNebula/terraform-provider-opennebula/opennebula.resourceOpennebulaDatastoreCreate({0x104fe40c8, 0x140003002a0}, 0x14000798000, {0x104ee1c00?, 0x1400053e100}) github.com/OpenNebula/terraform-provider-opennebula/opennebula/resource_opennebula_datastore.go:377 +0x9e8 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0x14000492fc0, {0x104fe4100, 0x140005cad80}, 0xd?, {0x104ee1c00, 0x1400053e100}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:707 +0xec github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0x14000492fc0, {0x104fe4100, 0x140005cad80}, 0x140003336c0, 0x14000445a00, {0x104ee1c00, 0x1400053e100}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:837 +0x874 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0x1400043a4c8, {0x104fe4100?, 0x140005cac60?}, 0x14000047a40) github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/grpc_provider.go:1021 +0xb94 github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ApplyResourceChange(0x14000380a00, {0x104fe4100?, 0x140005ca600?}, 0x1400023f490) github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/tf5server/server.go:818 +0x3c0 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x104fa8b80?, 0x14000380a00}, {0x104fe4100, 0x140005ca600}, 0x1400023f420, 0x0) github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x174 google.golang.org/grpc.(Server).processUnaryRPC(0x140002ea1e0, {0x104fe7340, 0x14000184680}, 0x140002f2d80, 0x1400045f380, 0x1054cf980, 0x0) google.golang.org/grpc@v1.56.3/server.go:1335 +0xc7c google.golang.org/grpc.(Server).handleStream(0x140002ea1e0, {0x104fe7340, 0x14000184680}, 0x140002f2d80, 0x0) google.golang.org/grpc@v1.56.3/server.go:1712 +0x840 google.golang.org/grpc.(Server).serveStreams.func1.1() google.golang.org/grpc@v1.56.3/server.go:947 +0xb4 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.56.3/server.go:958 +0x17c

Error: The terraform-provider-opennebula_v1.4.0 plugin crashed!`

Terraform and Provider version

Terraform 1.5.3 (linux_amd64) Provider registry.terraform.io/opennebula/opennebula v1.4.0

Affected resources and data sources

opennebula_datastore

Terraform configuration

resource "opennebula_datastore" "opennebula_datastore_image" {
  name                        = "ceph_img_${var.env}"
  type                        = "image"
  cluster_ids                 = [102]
  bridge_list                 = ["host01", "host02", "host03"]
    compatible_system_datastore = [207]
  ceph {
    pool_name  = "pool01"
    user       = "libvirt"
    config     = "/etc/ceph_mc/ceph.conf"
    rbd_format = 2
    secret     = "e4fb5f8f-36d8-4493-8504-a7a3e0ec158b"
    host       = ["10.10.17.10:6789", "10.10.17.10:3300", "10.10.17.16:6789", "10.10.17.16:3300"]
  }
}

Expected behavior

A Ceph datastore of type "IMAGE" should be created with compatible_system_datastore = 207.

Actual behavior

The datastore has created but provider plugin crashed. And datastore resource doesn't put in TF state.

Steps to Reproduce

Create the opennebula_datastore resource with type = "image", ceph { ... } block defined and compatible_system_datastore = [207] Without compatible_system_datastore parameter the datastore created successfully.

Debug output

No response

Panic output

No response

Important factoids

No response

References

No response

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 30 days with no activity and it has not the 'status: confirmed' label or it is not in a milestone. Remove the 'status: stale' label or comment, or this will be closed in 5 days.

tikondrus commented 3 months ago

Did you have time to check and reproduce this issue?

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 30 days with no activity and it has not the 'status: confirmed' label or it is not in a milestone. Remove the 'status: stale' label or comment, or this will be closed in 5 days.

tikondrus commented 2 months ago

Did you have time to check and reproduce this issue?

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity and it has not the 'status: confirmed' label or it is not in a milestone. Remove the 'status: stale' label or comment, or this will be closed in 5 days.

tikondrus commented 1 month ago

Did you have time to check and reproduce this issue?

tikondrus commented 1 month ago

looks like the issue has the same root cause as https://github.com/OpenNebula/terraform-provider-opennebula/issues/542

github-actions[bot] commented 4 days ago

This issue is stale because it has been open for 30 days with no activity and it has not the 'status: confirmed' label or it is not in a milestone. Remove the 'status: stale' label or comment, or this will be closed in 5 days.

tikondrus commented 3 days ago

Did you have time to check and reproduce this issue?