Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meraki_networks_switch_stp - plugin crash when reading #114

Closed
mcparaf opened this issue Jul 19, 2024 · 2 comments
Closed

meraki_networks_switch_stp - plugin crash when reading #114

mcparaf opened this issue Jul 19, 2024 · 2 comments

Comments

@mcparaf
Copy link

mcparaf commented Jul 19, 2024

Prerequisites

  • [ v ] Have you tested the operation in the API directly?
  • [ v ] Do you have the latest Terraform provider version?
  • [ x ] Review the compatibility matrix before opening an issue. - the page does not exist

Describe the bug
When trying to create a meraki_networks_switch_stp resource the plugin reads data first and then crashes while trying to parse resulting data.

locals {
  networks_switch_stp = flatten([
    for domain in try(local.meraki.domains, []) : [
      for org in try(domain.organizations, []) : [
        for network in try(org.networks, []) : {
          network_id = meraki_networks.networks["${domain.name}/${org.name}/${network.name}"].id
          data       = network.switch_stp
        } if try(network.switch_stp, null) != null
      ]
    ]
  ])
}

Plugin log:

2024-07-19T14:24:38.442+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ==============================================================================
2024-07-19T14:24:38.699+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 2024/07/19 14:24:38
2024-07-19T14:24:38.699+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ==============================================================================
2024-07-19T14:24:38.699+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ~~~ REQUEST ~~~
2024-07-19T14:24:38.699+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: GET  /api/v1/networks/L_709316941310853998/switch/stp  HTTP/1.1
2024-07-19T14:24:38.699+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: HOST   : api.meraki.com
2024-07-19T14:24:38.699+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: HEADERS:
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Accept: application/json
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Authorization: Bearer ****b91c9
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Content-Type: application/json
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	User-Agent: go-meraki/1.44.1 MerakiTerraform/1.47.0 Cisco
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: BODY   :
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ***** NO CONTENT *****
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ------------------------------------------------------------------------------
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ~~~ RESPONSE ~~~
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: STATUS       : 200 OK
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: PROTO        : HTTP/2.0
2024-07-19T14:24:38.700+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: RECEIVED AT  : 2024-07-19T14:24:38.699081+02:00
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: TIME DURATION: 260.491792ms
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: HEADERS      :
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Cache-Control: no-cache, no-store, max-age=0, must-revalidate
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Content-Type: application/json; charset=utf-8
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Date: Fri, 19 Jul 2024 12:24:38 GMT
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Expires: Fri, 01 Jan 1990 00:00:00 GMT
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Pragma: no-cache
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Strict-Transport-Security: max-age=31536000; includeSubDomains
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	Vary: Accept-Encoding
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	X-Content-Type-Options: nosniff
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	X-Frame-Options: sameorigin
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	X-Request-Id: c74fc010bbde2d70689780769721c139
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	X-Robots-Tag: none
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	X-Runtime: 0.043873
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	X-Xss-Protection: 1; mode=block, 1; mode=block
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: BODY         :
2024-07-19T14:24:38.701+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: {
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "rstpEnabled": true,
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "stpBridgePriority": [
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       {
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:          "switches": [
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:             "Q3LN-KJJ5-45ZR"
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:          ],
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:          "stpPriority": 32768
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       },
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       {
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:          "stacks": [
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:             "709316941310853232"
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:          ],
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:          "stpPriority": 4096
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       },
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       {
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:          "stacks": [
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:             "709316941310853254"
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:          ],
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:          "stpPriority": 32768
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       }
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    ]
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: }
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ==============================================================================
2024-07-19T14:24:38.702+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: panic: runtime error: invalid memory address or nil pointer dereference
2024-07-19T14:24:38.703+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: [signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x101133920]
2024-07-19T14:24:38.703+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha
2024-07-19T14:24:38.703+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: goroutine 65 [running]:
2024-07-19T14:24:38.703+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: github.com/cisco-open/terraform-provider-meraki/internal/provider.ResponseSwitchGetNetworkSwitchStpItemToBodyRs.func2(0x140003982a0, {{0x2, {0x140001a0690, 0x14}}, {0x2, 0x1}, 0x0, 0x0})
2024-07-19T14:24:38.703+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	github.com/cisco-open/terraform-provider-meraki/internal/provider/resource_meraki_networks_switch_stp.go:428 +0xd0
2024-07-19T14:24:38.703+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: github.com/cisco-open/terraform-provider-meraki/internal/provider.ResponseSwitchGetNetworkSwitchStpItemToBodyRs({{0x2, {0x140001a0690, 0x14}}, {0x2, 0x1}, 0x0, 0x0}, 0x14000122750?, 0x0)
2024-07-19T14:24:38.703+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	github.com/cisco-open/terraform-provider-meraki/internal/provider/resource_meraki_networks_switch_stp.go:452 +0x94
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: github.com/cisco-open/terraform-provider-meraki/internal/provider.(*NetworksSwitchStpResource).Create(0x14000074018, {0x101c1f348, 0x14000010d50}, {{{{0x101c26f88, 0x14000011f80}, {0x1019a3d00, 0x14000011ad0}}, {0x101c39128, 0x1400004e050}}, {{{0x101c26f88, ...}, ...}, ...}, ...}, ...)
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	github.com/cisco-open/terraform-provider-meraki/internal/provider/resource_meraki_networks_switch_stp.go:245 +0x550
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0x140001a5d40, {0x101c1f348, 0x14000010d50}, 0x14000143560, 0x14000143500)
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:101 +0x41c
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0x1400011d6c0?, {0x101c1f348, 0x14000010d50}, 0x14000014410, 0x140001436c0)
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	github.com/hashicorp/[email protected]/internal/fwserver/server_applyresourcechange.go:57 +0x380
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0x140001a5d40, {0x101c1f348?, 0x14000010c30?}, 0x14000014370)
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	github.com/hashicorp/[email protected]/internal/proto6server/server_applyresourcechange.go:55 +0x314
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0x140002b68c0, {0x101c1f348?, 0x14000010240?}, 0x140002ae000)
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:865 +0x2b0
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x101bcf940?, 0x140002b68c0}, {0x101c1f348, 0x14000010240}, 0x1400008a000, 0x0)
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:518 +0x164
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: google.golang.org/grpc.(*Server).processUnaryRPC(0x1400022f000, {0x101c1f348, 0x14000010180}, {0x101c37618, 0x1400047a000}, 0x14000016000, 0x140003959b0, 0x1024843d8, 0x0)
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	google.golang.org/[email protected]/server.go:1369 +0xba0
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: google.golang.org/grpc.(*Server).handleStream(0x1400022f000, {0x101c37618, 0x1400047a000}, 0x14000016000)
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	google.golang.org/[email protected]/server.go:1780 +0xc80
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: google.golang.org/grpc.(*Server).serveStreams.func2.1()
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	google.golang.org/[email protected]/server.go:1019 +0x8c
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 39
2024-07-19T14:24:38.704+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: 	google.golang.org/[email protected]/server.go:1030 +0x150
2024-07-19T14:24:38.707+0200 [ERROR] provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/cisco-open/meraki/0.2.5-alpha/darwin_arm64/terraform-provider-meraki_v0.2.5-alpha id=27390 error="exit status 2"

Expected behavior
Do not crash.

Environment (please complete the following information):

  • Meraki Dashboard version: current version at https://n260.meraki.com
  • Terraform version: 1.9.1
  • Meraki provider version: 0.2.5-alpha
  • OS Version: macOS Sonoma 14.5
fmunozmiranda added a commit that referenced this issue Jul 23, 2024
Failure when executing GetNetworkSwitchRoutingOspf #115
fmunozmiranda added a commit that referenced this issue Jul 23, 2024
BUGFIXES:
* meraki_networks_switch_stp - plugin crash when reading #114.
* Failure when executing GetNetworkSwitchRoutingOspf #115.
* meraki_networks_vlan_profiles silently fails when attempting to create a resource on the default profile #94.
* Resource meraki_networks_sensor_alerts_profiles error with operation CreateNetworkSensorAlertsProfile #91.
* Resource meraki_networks_wireless_rf_profiles error when trying to create new profile.
#88.
@fmunozmiranda
Copy link
Collaborator

@mcparaf please try it with new version and update us.

@mcparaf
Copy link
Author

mcparaf commented Jul 24, 2024

it's working, thanks :)

@mcparaf mcparaf closed this as completed Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants