cisco-en-programmability / terraform-provider-dnacenter

https://registry.terraform.io/providers/cisco-en-programmability/dnacenter/latest/docs
MIT License
14 stars 12 forks source link

Provider crash on dnacenter_wireless_provision_device_update #139

Closed pamosima closed 1 year ago

pamosima commented 1 year ago

Prerequisites

Describe the bug Provider crashes when running 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:

  # module.m3_wireless.dnacenter_wireless_provision_device_update.c9800 will be created
  + resource "dnacenter_wireless_provision_device_update" "c9800" {
      + id           = (known after apply)
      + item         = (known after apply)
      + last_updated = (known after apply)

      + parameters {
          + payload {
              + device_name         = "C9800.dcloud.cisco.com"
              + managed_aplocations = [
                  + "Global/DevNet",
                ]
            }
        }
    }

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

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Saved the plan to: general.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "general.tfplan"
admin@ubuntu2204:~/DevNet_Terraform-Workshop/examples/infra/example_devnet_zurich$ terraform apply "general.tfplan"
module.m3_wireless.dnacenter_wireless_provision_device_update.c9800: Creating...
╷
│ Error: Plugin did not respond
│ 
│   with module.m3_wireless.dnacenter_wireless_provision_device_update.c9800,
│   on ../../modules/m3_wireless/dnacenter_wireless_provision_device.tf line 26, in resource "dnacenter_wireless_provision_device_update" "c9800":
│   26: resource "dnacenter_wireless_provision_device_update" "c9800" {
│ 
│ 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-dnacenter_v1.0.18-beta plugin:

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

goroutine 51 [running]:
terraform-provider-dnacenter/dnacenter.resourceWirelessProvisionDeviceUpdateCreate({0x16bca28, 0xc0006c3620}, 0xc0007e56c0, {0x132cde0, 0xc000dd9540})
        terraform-provider-dnacenter/dnacenter/resource_wireless_provision_device_update.go:176 +0xfeb
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0004776c0, {0x16bc9b8, 0xc00114dac0}, 0x2, {0x132cde0, 0xc000dd9540})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:341 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0004776c0, {0x16bc9b8, 0xc00114dac0}, 0xc0006aa5b0, 0xc00009eb00, {0x132cde0, 0xc000dd9540})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:467 +0x871
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00000c3c0, {0x16bc9b8, 0xc00114dac0}, 0xc00112fbd0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/grpc_provider.go:977 +0xd8a
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000146a80, {0x16bca60, 0xc000a64000}, 0xc001129dc0)
        github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/tf5server/server.go:603 +0x30e
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x13f23c0, 0xc000146a80}, {0x16bca60, 0xc000a64000}, 0xc00114bd40, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000274e00, {0x16d03d8, 0xc0006f6000}, 0xc001089100, 0xc0007e74d0, 0x1dea000, 0x0)
        google.golang.org/grpc@v1.32.0/server.go:1194 +0xc8f
google.golang.org/grpc.(*Server).handleStream(0xc000274e00, {0x16d03d8, 0xc0006f6000}, 0xc001089100, 0x0)
        google.golang.org/grpc@v1.32.0/server.go:1517 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.32.0/server.go:859 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.32.0/server.go:857 +0x294

Error: The terraform-provider-dnacenter_v1.0.18-beta plugin crashed!

Expected behavior Provider is not supposed to crash.

Screenshots

image

Environment (please complete the following information):

Additional context terraform.log dnacenter_wireless_provision_device.tf.txt

fmunozmiranda commented 1 year ago

@pamosima please try it again with new version(v1.0.19-beta) and let us know how does it go.

fmunozmiranda commented 1 year ago

Hey @pamosima , If we do not receive a response from you in the next 24 hours, the issue will be closed.

pamosima commented 1 year ago

@fmunozmiranda with the new version the provider will not crash anymore but API payload still returns error 500

pamosima commented 1 year ago

@fmunozmiranda we get the following error when using v1.0.19-beta because of missing __persistbapioutput=true in the header:


{
"bapiKey": "87a5-ab04-4139-862d",
"bapiName": "Provision update",
"bapiExecutionId": "03ba0b5a-9117-469a-890e-ceeb95a72e55",
"startTime": "Tue Apr 04 13:55:12 UTC 2023",
"startTimeEpoch": 1680616512352,
"endTime": "Tue Apr 04 13:55:12 UTC 2023",
"endTimeEpoch": 1680616512376,
"timeDuration": 24,
"status": "FAILURE",
"bapiError": "undefined",
"runtimeInstanceId": "DNACP_Runtime_4e345a5f-0e15-47e7-abfa-e8ac504f2eb9"
}
fmunozmiranda commented 1 year ago

Hi @pamosima please try it again with v1.1.0-beta

pamosima commented 1 year ago

Hi @fmunozmiranda, this is working now but due to the update there is now an issue with dnacenter_site where a site_id is requested which wasn't before. Should I open a new issue for the dnacenter_site topic?

fmunozmiranda commented 1 year ago

Hi @pamosima yes, open new issue with required info. I'm going to close this one.