PaloAltoNetworks / terraform-provider-panos

Terraform Panos provider
https://www.terraform.io/docs/providers/panos/
Mozilla Public License 2.0
87 stars 69 forks source link

Provider plugin crash with panos_nat_rule_group #410

Closed denwurm closed 7 months ago

denwurm commented 9 months ago

Describe the bug

Terraform crashes when trying to apply panos_nat_rule_group configuration towards Panorama 11.0.2.

Using the same provider resource with VM-series 11.0.2 works as expected.

Expected behavior

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

Current behavior

╷ │ Error: Request cancelled │ │ with panos_nat_rule_group.bottom, │ on natrules.tf line 1, in resource "panos_nat_rule_group" "bottom": │ 1: resource "panos_nat_rule_group" "bottom" { │ │ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled. ╵

Stack trace from the terraform-provider-panos_v1.11.1 plugin:

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

goroutine 50 [running]: github.com/terraform-providers/terraform-provider-panos/panos.createUpdateNatRuleGroup(0xc00041ed20, {0x131bda0, 0xc00000a1e0}) github.com/terraform-providers/terraform-provider-panos/panos/nat_rule_group.go:175 +0xbfb github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Resource).Apply(0xc000605b80, 0xc000c1bb80, 0xc0005ef8e0, {0x131bda0, 0xc00000a1e0}) github.com/hashicorp/terraform-plugin-sdk@v1.17.2/helper/schema/resource.go:320 +0x438 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Provider).Apply(0xc0000fc680, 0xc000b31a68, 0x132fd4b, 0xf) github.com/hashicorp/terraform-plugin-sdk@v1.17.2/helper/schema/provider.go:294 +0x70 github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(GRPCProviderServer).ApplyResourceChange(0xc00011e418, {0xc00058a930, 0x4b5646}, 0xc00058a930) github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/helper/plugin/grpc_provider.go:895 +0x7c5 github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x12e14c0, 0xc00011e418}, {0x1572b90, 0xc000804180}, 0xc000c03da0, 0x0) github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/tfplugin5/tfplugin5.pb.go:3305 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc00035b880, {0x1583bc0, 0xc0000f8480}, 0xc000262500, 0xc00081e4b0, 0x1d5c340, 0x0) google.golang.org/grpc@v1.32.0/server.go:1194 +0xc8f google.golang.org/grpc.(Server).handleStream(0xc00035b880, {0x1583bc0, 0xc0000f8480}, 0xc000262500, 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-panos_v1.11.1 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.

Possible solution

Steps to reproduce

  1. Provider: PaloAltoNetworks/panos ver 1.11.1
  2. Terraform v1.5.7
  3. Panorama 11.0.2 in Google Cloud Platform.

Screenshots

Context

I want to push NAT-rules via Terraform to a device group (which doesn't work either due to "Unsupported Argument" but is a separate issue).

Your Environment

shinmog commented 7 months ago

Based on the line that error is from, you're targeting a Panorama but are using the NGFW resource. Use panos_panorama_nat_rule_group instead.