jeremmfr / terraform-provider-junos

Terraform provider for Junos devices
https://registry.terraform.io/providers/jeremmfr/junos
MIT License
62 stars 22 forks source link

Bug: with ressource junos_system.system web_management_https #588

Closed lotusnoir closed 11 months ago

lotusnoir commented 11 months ago

Hello, there is an issue with the ressource "system" and the block "web_management_https", when i try to create it i have a crash:

terraform version Terraform v1.6.3

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:

  # junos_system.system will be created
  + resource "junos_system" "system" {
      + id = (known after apply)

      + services {
          + web_management_https {
              + interface                    = [
                  + "fxp0.0",
                ]
              + system_generated_certificate = true
            }
        }
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

junos_system.system: Creating...
╷
│ Error: Request cancelled
│ 
│   with junos_system.system,
│   on fwv-rbx59-08-test.tf line 1, in resource "junos_system" "system":
│    1: resource "junos_system" "system" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-junos_v2.3.1 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x9cea23]

goroutine 26 [running]:
github.com/jeremmfr/terraform-provider-junos/internal/providerfwk.(*systemBlockServices).configSet(0xc00081a5a0)
    github.com/jeremmfr/terraform-provider-junos/internal/providerfwk/resource_system.go:3576 +0x35c3
github.com/jeremmfr/terraform-provider-junos/internal/providerfwk.(*systemData).set(0xc0000e8160, {0x171aca0?, 0xc000736fc0?}, 0x13f8360?)
    github.com/jeremmfr/terraform-provider-junos/internal/providerfwk/resource_system.go:3027 +0x27ed
github.com/jeremmfr/terraform-provider-junos/internal/providerfwk.defaultResourceCreate({0x171aca0, 0xc000736fc0}, {0x17160f8, 0xc000060578}, 0x0, 0x0, {0x1716120?, 0xc0000e8160}, 0xc0006341e0)
    github.com/jeremmfr/terraform-provider-junos/internal/providerfwk/default_resource_op.go:118 +0x5b8
github.com/jeremmfr/terraform-provider-junos/internal/providerfwk.(*system).Create(0xd?, {0x171aca0, 0xc000736fc0}, {{{{0x1720598, 0xc000898f30}, {0x12d1d20, 0xc0007761e0}}, {0x17228b0, 0xc0002b5d60}}, {{{0x1720598, ...}, ...}, ...}, ...}, ...)
    github.com/jeremmfr/terraform-provider-junos/internal/providerfwk/resource_system.go:2774 +0x165
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0xc0000e8f20, {0x171aca0, 0xc000736fc0}, 0xc0008cf2f0, 0xc0008cf290)
    github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/fwserver/server_createresource.go:101 +0x578
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0xc00075f448?, {0x171aca0, 0xc000736fc0}, 0xc00073a410, 0xc0008cf448)
    github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/fwserver/server_applyresourcechange.go:57 +0x4a5
github.com/hashicorp/terraform-plugin-framework/internal/proto5server.(*Server).ApplyResourceChange(0xc0000e8f20, {0x171aca0?, 0xc000736ea0?}, 0xc00073a370)
    github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/proto5server/server_applyresourcechange.go:55 +0x3ff
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x171acd8?, {0x171aca0?, 0xc000736ba0?}, 0xc00073a370)
    github.com/hashicorp/terraform-plugin-mux@v0.12.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0003aa1e0, {0x171aca0?, 0xc0007361b0?}, 0xc0001e0150)
    github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/tf5server/server.go:859 +0x56a
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x13c1680?, 0xc0003aa1e0}, {0x171aca0, 0xc0007361b0}, 0xc0001e00e0, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0004ce000, {0x1721120, 0xc0001029c0}, 0xc00073e000, 0xc000225770, 0x1e62998, 0x0)
    google.golang.org/grpc@v1.57.1/server.go:1358 +0xe15
google.golang.org/grpc.(*Server).handleStream(0xc0004ce000, {0x1721120, 0xc0001029c0}, 0xc00073e000, 0x0)
    google.golang.org/grpc@v1.57.1/server.go:1735 +0x9e7
google.golang.org/grpc.(*Server).serveStreams.func1.1()
    google.golang.org/grpc@v1.57.1/server.go:970 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 21
    google.golang.org/grpc@v1.57.1/server.go:981 +0x145

Error: The terraform-provider-junos_v2.3.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.

No problems with the http one:

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:

  # junos_system.system will be created
  + resource "junos_system" "system" {
      + id = (known after apply)

      + services {
          + web_management_http {
              + interface = [
                  + "fxp0.0",
                ]
            }
        }
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

junos_system.system: Creating...
junos_system.system: Creation complete after 6s [id=system]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
jeremmfr commented 11 months ago

Hi 👋

Thank you for raising this issue. I'll take care of fixing it quickly.