fortinetdev / terraform-provider-fortiswitch

Mozilla Public License 2.0
0 stars 0 forks source link

Trying to apply dynamic_sort_subtable = "false" results in a failure #4

Closed donnieelmore closed 2 weeks ago

donnieelmore commented 1 month ago

I recently started terraforming our Fortswitch. Wrote the config to match what we have configured already and imported all resources to Terraform. One thing that is showing as a discrepancy is dynamic_sort_subtable = "false" on several different resources, no matter what I set the setting to it shows a changed. That is fine though, we'd seen things like this with other providers. However when I go to apply this setting it fails and dump the following stack trace:

donnie.elmore:~/git/terraform/fortiswitch (main)$ terraform apply -parallelism=1 -target=fortiswitch_systemsnmp_community.snmp
module.global_variables.data.vault_generic_secret.fortiswitch_credentials: Reading...
module.global_variables.data.vault_generic_secret.fortiswitch_credentials: Read complete after 0s [id=networking/switch001]
fortiswitch_systemsnmp_community.snmp: Refreshing state... [id=2]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # fortiswitch_systemsnmp_community.snmp will be updated in-place
  ~ resource "fortiswitch_systemsnmp_community" "snmp" {
      + dynamic_sort_subtable = "false"
        id                    = "2"
        name                  = "switch001_snmp"
        # (13 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
╷
│ Warning: Resource targeting is in effect
│ 
│ You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
│ 
│ The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵

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

fortiswitch_systemsnmp_community.snmp: Modifying... [id=2]
╷
│ Warning: Applied changes may be incomplete
│ 
│ The plan was created with the -target option in effect, so some changes requested in the configuration may have been ignored and the output values may not be fully updated. Run the following command to verify that no other changes are pending:
│     terraform plan
│ 
│ Note that the -target option is not suitable for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵
╷
│ Error: Request cancelled
│ 
│   with fortiswitch_systemsnmp_community.snmp,
│   on system.tf line 89, in resource "fortiswitch_systemsnmp_community" "snmp":
│   89: resource "fortiswitch_systemsnmp_community" "snmp" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-fortiswitch_v1.1.2 plugin:

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

goroutine 44 [running]:
github.com/terraform-providers/terraform-provider-fortiswitch/fortiswitch.resourceSystemSnmpCommunityUpdate(0x1400072b200, {0x10100f760, 0x1400042a3e0})
        github.com/terraform-providers/terraform-provider-fortiswitch/fortiswitch/resource_systemsnmp_community.go:214 +0x2ec
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x10115f9c0?, {0x10115f9c0?, 0x140008ab3b0?}, 0xd?, {0x10100f760?, 0x1400042a3e0?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/resource.go:800 +0x130
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x14000088c40, {0x10115f9c0, 0x140008ab3b0}, 0x140008a6d00, 0x1400072b080, {0x10100f760, 0x1400042a3e0})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/resource.go:919 +0x670
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1400038afa8, {0x10115f9c0?, 0x140008ab2f0?}, 0x14000252af0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/grpc_provider.go:1060 +0xaa4
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x1400025ea00, {0x10115f9c0?, 0x140008aa930?}, 0x1400015c770)
        github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/tf5server/server.go:859 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1011263e0, 0x1400025ea00}, {0x10115f9c0, 0x140008aa930}, 0x1400015c700, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140002561e0, {0x101164100, 0x1400076c000}, 0x14000454480, 0x14000681bf0, 0x10178dc98, 0x0)
        google.golang.org/grpc@v1.57.0/server.go:1360 +0xbb4
google.golang.org/grpc.(*Server).handleStream(0x140002561e0, {0x101164100, 0x1400076c000}, 0x14000454480, 0x0)
        google.golang.org/grpc@v1.57.0/server.go:1737 +0x7ac
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.57.0/server.go:982 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 71
        google.golang.org/grpc@v1.57.0/server.go:980 +0x140

Error: The terraform-provider-fortiswitch_v1.1.2 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.

Thanks, Donnie

MaxxLiu22 commented 1 month ago

Hi @donnieelmore ,

Thank you for bringing this issue to our attention. It seems to be caused by a data type mismatch in block host6. I have reported this to the development team, along with your previous inquiry. We sincerely appreciate your continued support of our provider. Let me know if you still have other questions.

Thanks, Maxx

MaxxLiu22 commented 1 month ago

Hi @donnieelmore ,

We are pleased to announce the release of Terraform FSW 1.1.3. This version addresses the issue, so please feel free to upgrade and give it a try. If you have any further questions, don't hesitate to reach out

Thanks, Maxx