Error got unconvertible type

Hello,

I would like to know where this error come from:

Error: local_context_data: '' expected type 'string', got unconvertible type 'map[string]interface {}', value: 'map[hello:world]'
│ 
│   with netbox_virtualization_vm.vm_test,
│   on main.tf line 271, in resource "netbox_virtualization_vm" "vm_test":
│  271: resource "netbox_virtualization_vm" "vm_test" {

From terraform ?
From the application itself ?
From my terraform provider ?

Thanks.

Hi @smutel :wave: Unfortunately it is not immediately clear (at least to me) where this error message came from just the Terraform CLI user interface output. If you enable logging with Terraform CLI, such as running TF_LOG=TRACE terraform apply, you may get some additional clues about when the error was generated which might help track down what generated it.

If you are using github.com/hashicorp/terraform-plugin-sdk, one of the underlying dependencies is github.com/mitchellh/mapstructure, which can potentially generate a message like this. If that is the case, then it could potentially occur if the resource state data was written with a different type then the resource schema was changed to a string. In that case, the provider should implement a state upgrade to translate the data from the old type to the new type.

For what its worth, I do notice that GitHub - smutel/terraform-provider-netbox: Terraform provider for Netbox (if this is the provider in question) is depending on version 1 of terraform-plugin-sdk, which is no longer supported, even if there is a bug. It may be worth investigating the upgrade to version 2, to see if it helps resolve this issue or at least has better logging for troubleshooting further.