go-gandi / terraform-provider-gandi

Terraform provider for the Gandi Domain services
Mozilla Public License 2.0
152 stars 45 forks source link

Panic on 404 and 409 from API (v2.2.0) #134

Closed dsx closed 1 year ago

dsx commented 1 year ago

When domains are absent in LiveDNS, plugin causes panic:

module.gandi.gandi_livedns_domain.domain-a: Creating...
module.gandi.gandi_livedns_domain.domain-b: Creating...
module.gandi.gandi_livedns_domain.domain-d: Creating...
module.gandi.gandi_livedns_domain.domian-e: Creating...
╷
│ Error: Plugin did not respond
│ 
│   with module.gandi.gandi_livedns_domain.domian-e,
│   on modules/gandi/domian-e.tf line 5, in resource "gandi_livedns_domain" "domian-e":
│    5: resource "gandi_livedns_domain" "domian-e" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: StatusCode: 404 ; Err: 404: The resource could not be found. 
│ 
│   with module.gandi.gandi_livedns_domain.domain-b,
│   on modules/gandi/domain-b.tf line 5, in resource "gandi_livedns_domain" "domain-b":
│    5: resource "gandi_livedns_domain" "domain-b" {
│ 
╵
╷
│ Error: StatusCode: 409 ; Err: 409: The domain domain-a.es already exists 
│ 
│   with module.gandi.gandi_livedns_domain.domain-a,
│   on modules/gandi/domain-a.tf line 3, in resource "gandi_livedns_domain" "domain-a":
│    3: resource "gandi_livedns_domain" "domain-a" {
│ 
╵
╷
│ Error: StatusCode: 404 ; Err: 404: The resource could not be found. 
│ 
│   with module.gandi.gandi_livedns_domain.domain-d,
│   on modules/gandi/domain-d.tf line 5, in resource "gandi_livedns_domain" "domain-d":
│    5: resource "gandi_livedns_domain" "domain-d" {
│ 
╵

Stack trace from the terraform-provider-gandi_v2.2.0 plugin:

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

goroutine 69 [running]:
github.com/go-gandi/terraform-provider-gandi/v2/gandi.resourceLiveDNSDomainCreate(0xc0007ebb80, 0xbe3380, 0xc000529b90, 0x0, 0xffffffffffffffff)
    github.com/go-gandi/terraform-provider-gandi/v2/gandi/resource_livedns_domain.go:58 +0x3b3
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0003d8620, 0xe334e0, 0xc0001ec180, 0xc0007ebb80, 0xbe3380, 0xc000529b90, 0x0, 0x0, 0x0)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/resource.go:695 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003d8620, 0xe334e0, 0xc0001ec180, 0xc0001f01a0, 0xc0007eba00, 0xbe3380, 0xc000529b90, 0x0, 0x0, 0x0, ...)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/resource.go:837 +0x79d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000330078, 0xe33438, 0xc0007b8f40, 0xc0002af0e0, 0xd395d0, 0x12, 0x0)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/grpc_provider.go:1021 +0xb4f
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0001d2140, 0xe334e0, 0xc000571950, 0xc00056c8c0, 0x0, 0x0, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.9.0/tfprotov5/tf5server/server.go:812 +0x73c
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0xcfaca0, 0xc0001d2140, 0xe334e0, 0xc000571950, 0xc000307b60, 0x0, 0xe334e0, 0xc000571950, 0xc0002d26e0, 0x14c)
    github.com/hashicorp/terraform-plugin-go@v0.9.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002c0540, 0xe3a8f8, 0xc0003d61a0, 0xc0001c6000, 0xc000297530, 0x1299560, 0x0, 0x0, 0x0)
    google.golang.org/grpc@v1.45.0/server.go:1282 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0002c0540, 0xe3a8f8, 0xc0003d61a0, 0xc0001c6000, 0x0)
    google.golang.org/grpc@v1.45.0/server.go:1619 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000300210, 0xc0002c0540, 0xe3a8f8, 0xc0003d61a0, 0xc0001c6000)
    google.golang.org/grpc@v1.45.0/server.go:921 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
    google.golang.org/grpc@v1.45.0/server.go:919 +0x1fd

Error: The terraform-provider-gandi_v2.2.0 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.
nlewo commented 1 year ago

@dsx This should be fixed by #135

nlewo commented 1 year ago

The v2.2.1 release fix this issue.