terraform-routeros / terraform-provider-routeros

Terraform Provider for Mikrotik RouterOS
Mozilla Public License 2.0
166 stars 46 forks source link

Crash when using store_leases_disk in routeros_ip_dhcp_server_config #447

Closed tofkamp closed 2 months ago

tofkamp commented 2 months ago

Describe the bug When I set the attribute store_leases_disk of routeros_ip_dhcp_server_config, I get an crash. Remove the attribute, and all goed well.

To Reproduce

########### DHCP Server ############
resource "routeros_ip_dhcp_server_config" "DHCPsettings" {
  accounting = false
  interim_update = "0"
  radius_password = "same-as-user"
  store_leases_disk = "0"
}

I tried the store_leases_disk with "never", just a number, numer in quotes, but everything make it crashe. Just put a "#" in front, or remove the line, solves the crash.

[admin@sophos] > /ip/dhcp/config/print
  store-leases-disk: never
         accounting: no
     interim-update: 0s
    radius-password: empty

Expected behavior No crash, but some complain what I am doing wrong.

Stack Trace

│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).UpgradeResourceState call. The
│ plugin logs may contain more details.
╵

Stack trace from the terraform-provider-routeros_v1.48.0.exe plugin:

panic: [TimeEquall] parse 'old' duration error: time: invalid duration "immediately"

goroutine 251 [running]:
github.com/terraform-routeros/terraform-provider-routeros/routeros.glob..func6({0xd05687?, 0xd05687?}, {0xc00070a6d0, 0xb}, {0xc00070a6ea, 0x3}, 0xc000c06680?)
        github.com/terraform-routeros/terraform-provider-routeros/routeros/provider_schema_helpers.go:608 +0x1a5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x6?, {0xe55c08, 0xc000a65170}, {0xd05687, 0x11}, 0xc00040ab40, 0xc000c06600, {0xe59160?, 0xc000c06680}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/schema.go:1143 +0x392
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc0004086f0, {0xe55c08, 0xc000a65170}, 0xc0009ac410, 0xc00088a910, 0x0, {0xcc2500, 0xc0004cf3b0}, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/schema.go:678 +0x332
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0xe55b28?, {0xe55c08?, 0xc000a65170?}, 0xc0009ac410, 0xc00f40?, {0xcc2500?, 0xc0004cf3b0?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:962 +0xd5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc000008678, {0xe55c08?, 0xc000a65080?}, 0xc00088a640)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:798 +0x9b6
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0xc0002df720, {0xe55c08?, 0xc000a64870?}, 0xc0002100e0)
        github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/tf5server/server.go:811 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0xcd3ba0?, 0xc0002df720}, {0xe55c08, 0xc000a64870}, 0xc000c06300, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:500 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003ec000, {0xe55c08, 0xc000a647e0}, {0xe59ed8, 0xc0006841a0}, 0xc000530c60, 0xc000012a80, 0x1415bc0, 0x0)
        google.golang.org/grpc@v1.61.1/server.go:1385 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc0003ec000, {0xe59ed8, 0xc0006841a0}, 0xc000530c60)
        google.golang.org/grpc@v1.61.1/server.go:1796 +0xfec
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.61.1/server.go:1029 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 52
        google.golang.org/grpc@v1.61.1/server.go:1040 +0x135

Error: The terraform-provider-routeros_v1.48.0.exe 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.

Additional context architecture_name = "x86_64" board_name = "CHR" version = "7.14.3 (stable)" OpenTofu v1.6.2 on windows_amd64

vaerh commented 2 months ago

Oh, there's another gray hair coming in :) I'll fix it right now...

vaerh commented 2 months ago

:tada: This issue has been resolved in version 1.48.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: