OpenNebula / terraform-provider-opennebula

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

Provider 1.4.0-rc2 crashes when changing marketplace appliance version #521

Closed frousselet closed 5 months ago

frousselet commented 5 months ago

Description

The provider 1.4.0-rc2 crashes when changing marketplace appliance version

Terraform and Provider version

1.4.0-rc2

Affected resources and data sources

opennebula_marketplace_appliance

Terraform configuration

resource "opennebula_marketplace_appliance" "test_marketplace_s3_clone_from_url" {
  name        = "test-marketplace-url"
  market_id   = opennebula_marketplace.test_marketplace_s3.id
  type        = "IMAGE"
  description = "this is an app"
  version     = "0.3.0"
  origin_id   = opennebula_image.test_marketplace_s3_clone_from_url.id
}

Expected behavior

Versions updates

Actual behavior

Provider crashes

Steps to Reproduce

Deploy with version 0.1.0 -> Fine Change to version 0.3.0 -> KO

Debug output

2024-01-19T14:46:49.069+0100 [ERROR] vertex "opennebula_marketplace_appliance.test_marketplace_s3_clone_from_url" error: Plugin did not respond
╷
│ Error: Plugin did not respond
│ 
│   with opennebula_marketplace_appliance.test_marketplace_s3_clone_from_url,
│   on test_marketplace.tf line 47, in resource "opennebula_marketplace_appliance" "test_marketplace_s3_clone_from_url":
│   47: resource "opennebula_marketplace_appliance" "test_marketplace_s3_clone_from_url" {
│ 
│ 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 plugin:

panic: interface conversion: interface {} is string, not int

goroutine 27 [running]:
github.com/OpenNebula/terraform-provider-opennebula/opennebula.resourceOpennebulaMarketPlaceAppUpdate({0x10390f950, 0x140002f92d0}, 0x14000434a80, {0x103803c00?, 0x1400001e900?})
    /Users/fro/Projets/github/opennebula/terraform-provider-opennebula/opennebula/resource_opennebula_marketplace_app.go:576 +0x25fc
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x14000498ee0, {0x10390f8a8, 0x14000290e70}, 0xd?, {0x103803c00, 0x1400001e900})
    /Users/fro/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:741 +0xe8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x14000498ee0, {0x10390f8a8, 0x14000290e70}, 0x140002885b0, 0x14000434900, {0x103803c00, 0x1400001e900})
    /Users/fro/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:847 +0x63c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1400000e030, {0x10390f8a8?, 0x14000290d80?}, 0x140001dc640)
    /Users/fro/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/grpc_provider.go:1021 +0xb08
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140004aa000, {0x10390f8a8?, 0x14000186c60?}, 0x140002f8070)
    /Users/fro/go/pkg/mod/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({0x1038d1a60?, 0x140004aa000}, {0x10390f8a8, 0x14000186c60}, 0x140002f8000, 0x0)
    /Users/fro/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x164
google.golang.org/grpc.(*Server).processUnaryRPC(0x140000ba000, {0x103914060, 0x1400019fa00}, 0x1400017e000, 0x1400049e300, 0x103e58cc0, 0x0)
    /Users/fro/go/pkg/mod/google.golang.org/grpc@v1.56.3/server.go:1335 +0xbe0
google.golang.org/grpc.(*Server).handleStream(0x140000ba000, {0x103914060, 0x1400019fa00}, 0x1400017e000, 0x0)
    /Users/fro/go/pkg/mod/google.golang.org/grpc@v1.56.3/server.go:1712 +0x7cc
google.golang.org/grpc.(*Server).serveStreams.func1.1()
    /Users/fro/go/pkg/mod/google.golang.org/grpc@v1.56.3/server.go:947 +0xb4
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 22
    /Users/fro/go/pkg/mod/google.golang.org/grpc@v1.56.3/server.go:958 +0x160

Error: The terraform-provider-opennebula plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

2024-01-19T14:46:49.076+0100 [DEBUG] provider: plugin exited
2024-01-19T14:46:49.150+0100 [INFO]  Terraform version: 1.6.6                                                                                                                       
2024-01-19T14:46:49.150+0100 [DEBUG] using github.com/hashicorp/go-tfe v1.36.0
2024-01-19T14:46:49.150+0100 [DEBUG] using github.com/hashicorp/hcl/v2 v2.19.1
2024-01-19T14:46:49.150+0100 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-01-19T14:46:49.150+0100 [DEBUG] using github.com/zclconf/go-cty v1.14.1
2024-01-19T14:46:49.150+0100 [INFO]  Go runtime version: go1.21.5
2024-01-19T14:46:49.150+0100 [INFO]  CLI args: []string{"/opt/homebrew/Cellar/tfenv/3.0.0/versions/1.6.6/terraform", "--version"}
2024-01-19T14:46:49.150+0100 [DEBUG] Attempting to open CLI config file: /Users/fro/.terraformrc
2024-01-19T14:46:49.150+0100 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2024-01-19T14:46:49.150+0100 [DEBUG] checking for credentials in "/Users/fro/.terraform.d/plugins"
2024-01-19T14:46:49.150+0100 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2024-01-19T14:46:49.150+0100 [DEBUG] will search for provider plugins in /Users/fro/.terraform.d/plugins
2024-01-19T14:46:49.150+0100 [DEBUG] ignoring non-existing provider search directory /Users/fro/Library/Application Support/io.terraform/plugins
2024-01-19T14:46:49.150+0100 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2024-01-19T14:46:49.151+0100 [INFO]  CLI command args: []string{"version", "--version"}

Panic output

panic: interface conversion: interface {} is string, not int

Important factoids

No response

References

No response