Closed bartoqid closed 2 years ago
With all the changes to security rules, this seems to be fixed. Was able to do this and no crash happened:
resource "panos_security_policy" "x" {
device_group = "serial chk"
rulebase = "pre-rulebase"
}
terraform import panos_security_policy.x 'serial chk:pre-rulebase:'
Describe the bug
When I tried to import the Panorama pre-rulebase into Terraform, it crashes. I have tried using other resoruces i.e : static objects and I was able to successfully import the resource
Expected behavior
Should successfully import the Panorama Security Policies into Terraform
Current behavior
Crashes during import
Steps to reproduce
provider "panos" { hostname = var.hostname username = var.username password = var.password }
resource "panos_panorama_security_policy" "Lab-DG-Pre-rule" { }
Screenshots
terraform import panos_panorama_security_policy.Lab-DG-Pre-rule LAB-DG:post-rulebase panos_panorama_security_policy.Lab-DG-Pre-rule: Importing from ID "LAB-DG:post-rulebase"... panos_panorama_security_policy.Lab-DG-Pre-rule: Import prepared! Prepared panos_panorama_security_policy for import panos_panorama_security_policy.Lab-DG-Pre-rule: Refreshing state... [id=LAB-DG:post-rulebase]
Error: rpc error: code = Unavailable desc = transport is closing
panic: runtime error: index out of range [0] with length 0 2021-02-11T12:51:13.778+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: 2021-02-11T12:51:13.778+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: goroutine 24 [running]: 2021-02-11T12:51:13.778+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: github.com/terraform-providers/terraform-provider-panos/panos.readPanoramaSecurityPolicy(0xc0001a2540, 0x200dd80, 0xc00017ca80, 0xc0001a2540, 0x0) 2021-02-11T12:51:13.778+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: github.com/terraform-providers/terraform-provider-panos/panos/resource_panorama_security_policy.go:345 +0x1e3a 2021-02-11T12:51:13.778+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Resource).RefreshWithoutUpgrade(0xc0000b3c00, 0xc0007f8550, 0x200dd80, 0xc00017ca80, 0xc000092188, 0x0, 0x0) 2021-02-11T12:51:13.778+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: github.com/hashicorp/terraform-plugin-sdk@v1.4.0/helper/schema/resource.go:455 +0x119 2021-02-11T12:51:13.778+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(GRPCProviderServer).ReadResource(0xc000714358, 0x22f73e0, 0xc0003ca270, 0xc0007f8190, 0xc000714358, 0xc0003ca270, 0xc0007bfa48) 2021-02-11T12:51:13.778+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: github.com/hashicorp/terraform-plugin-sdk@v1.4.0/internal/helper/plugin/grpc_provider.go:525 +0x3d8 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadResource_Handler(0x1fcf680, 0xc000714358, 0x22f73e0, 0xc0003ca270, 0xc0004525a0, 0x0, 0x22f73e0, 0xc0003ca270, 0xc00024e100, 0x73) 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: github.com/hashicorp/terraform-plugin-sdk@v1.4.0/internal/tfplugin5/tfplugin5.pb.go:3153 +0x217 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: google.golang.org/grpc.(Server).processUnaryRPC(0xc0002fa2c0, 0x2303ee0, 0xc000703500, 0xc00027e000, 0xc000254420, 0x2bc3bf0, 0x0, 0x0, 0x0) 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: google.golang.org/grpc@v1.23.0/server.go:995 +0x460 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: google.golang.org/grpc.(Server).handleStream(0xc0002fa2c0, 0x2303ee0, 0xc000703500, 0xc00027e000, 0x0) 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: google.golang.org/grpc@v1.23.0/server.go:1275 +0xd3d 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: google.golang.org/grpc.(Server).serveStreams.func1.1(0xc0000961b0, 0xc0002fa2c0, 0x2303ee0, 0xc000703500, 0xc00027e000) 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: google.golang.org/grpc@v1.23.0/server.go:710 +0xa1 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: created by google.golang.org/grpc.(Server).serveStreams.func1 2021-02-11T12:51:13.779+1100 [DEBUG] plugin.terraform-provider-panos_v1.8.0: google.golang.org/grpc@v1.23.0/server.go:708 +0xa1 2021/02/11 12:51:13 [TRACE] vertex "import panos_panorama_security_policy.Lab-DG-Pre-rule result": visit complete 2021/02/11 12:51:13 [TRACE] vertex "panos_panorama_security_policy.Lab-DG-Pre-rule (import id \"LAB-DG:post-rulebase\")": dynamic subgraph encountered errors 2021/02/11 12:51:13 [TRACE] vertex "panos_panorama_security_policy.Lab-DG-Pre-rule (import id \"LAB-DG:post-rulebase\")": visit complete 2021-02-11T12:51:13.783+1100 [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/paloaltonetworks/panos/1.8.0/darwin_amd64/terraform-provider-panos_v1.8.0 pid=23117 error="exit status 2" 2021/02/11 12:51:13 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/paloaltonetworks/panos\"] (close)" errored, so skipping 2021/02/11 12:51:13 [TRACE] dag/walk: upstream of "root" errored, so skipping 2021/02/11 12:51:13 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info 2021/02/11 12:51:13 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock 2021-02-11T12:51:13.784+1100 [DEBUG] plugin: plugin exited
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Terraform crashed! This is always indicative of a bug within Terraform. A crash log has been placed at "crash.log" relative to your current working directory. It would be immensely helpful if you could please report the crash with Terraform1 so that we can fix this.
When reporting bugs, please include your terraform version. That information is available on the first line of crash.log. You can also get it by running 'terraform --version' on the command line.
SECURITY WARNING: the "crash.log" file that was created may contain sensitive information that must be redacted before it is safe to share on the issue tracker.
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your Environment
Version used: Terraform v0.14.6 provider registry.terraform.io/paloaltonetworks/panos v1.8.0
Operating System and version (desktop or mobile): MACOS 10.15.7