Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin crashes accessing a not existing zone via datasource #14

Closed
c33s opened this issue Sep 6, 2020 · 6 comments
Closed

Plugin crashes accessing a not existing zone via datasource #14

c33s opened this issue Sep 6, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@c33s
Copy link

c33s commented Sep 6, 2020

terraform versions tried:

  • 0.11.14
  • 0.12.29
  • 0.13.1

  • running on windows
  • with strict firewall (also local connections and outbound connections have to be allowed(allowed for terraform and the plugins))
  • connection through a http proxy

no problem with hcloud plugin but hetznerdns is always crashing. also tried lower versions of this plugin but also crashed all the time (there where different error messages which i haven't written down). can provide the crash log if required (left them off this ticket because it would need redacting). also removed some paths from the crashoutput below.

0.11.14:

data.hetznerdns_zone.dns_zone: Refreshing state...

Error: Error refreshing state: 1 error occurred:
        * data.hetznerdns_zone.dns_zone: 1 error occurred:
        * data.hetznerdns_zone.dns_zone: data.hetznerdns_zone.dns_zone: unexpected EOF

panic: runtime error: invalid memory address or nil pointer dereference
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: [signal 0xc0000005 code=0x0 addr=0
x18 pc=0xd4ef12]
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: goroutine 70 [running]:
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/timohirt/terraform-prov
ider-hetznerdns/hetznerdns.dataSourceHetznerDNSZoneRead(0xc00079eb60, 0xf444e0, 0xc0006487a0, 0xc00079eb60, 0x0)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/work/terraform-prov
ider-hetznerdns/terraform-provider-hetznerdns/hetznerdns/data_source_zone.go:40 +0x162
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plu
gin-sdk/helper/schema.(*Resource).ReadDataApply(0xc000458e10, 0xc000796da0, 0xf444e0, 0xc0006487a0, 0xc00079a568, 0x40cb
01, 0xc00068e600)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.c
om/hashicorp/terraform-plugin-sdk@v1.12.0/helper/schema/resource.go:403 +0x8f
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plu
gin-sdk/helper/schema.(*Provider).ReadDataApply(0xc00078a980, 0xc000788e00, 0xc000796da0, 0xc00068e600, 0x100, 0x1c5ffff
)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.c
om/hashicorp/terraform-plugin-sdk@v1.12.0/helper/schema/provider.go:451 +0x96
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plu
gin-sdk/plugin.(*ResourceProviderServer).ReadDataApply(0xc00070b0a0, 0xc000794710, 0xc000794880, 0x0, 0x0)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.c
om/hashicorp/terraform-plugin-sdk@v1.12.0/plugin/resource_provider.go:607 +0x55
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: reflect.Value.call(0xc000206480, 0
xc000006098, 0x13, 0xf8917f, 0x4, 0xc000075f08, 0x3, 0x3, 0xc000075f34, 0xc000784300, ...)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x
64/src/reflect/value.go:460 +0x8b2
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: reflect.Value.Call(0xc000206480, 0
xc000006098, 0x13, 0xc000075f08, 0x3, 0x3, 0x55a9fca3c68, 0xc000292000, 0xc000292000)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x
64/src/reflect/value.go:321 +0xbb
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: net/rpc.(*service).call(0xc0000760
40, 0xc00064a190, 0xc000094050, 0xc000094060, 0xc00016e480, 0xc000648180, 0xdb84e0, 0xc000794710, 0x16, 0xdb8520, ...)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x
64/src/net/rpc/server.go:377 +0x186
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: created by net/rpc.(*Server).Serve
Codec
2020-09-06T11:53:38.482+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x
64/src/net/rpc/server.go:474 +0x432
2020/09/06 11:53:38 [ERROR] root: eval: *terraform.EvalReadDataApply, err: data.hetznerdns_zone.dns_zone: unexpected EOF

2020/09/06 11:53:38 [ERROR] root: eval: *terraform.EvalSequence, err: data.hetznerdns_zone.dns_zone: unexpected EOF
2020/09/06 11:53:38 [TRACE] [walkRefresh] Exiting eval tree: data.hetznerdns_zone.dns_zone
2020/09/06 11:53:38 [TRACE] dag/walk: upstream errored, not walking "provider.hetznerdns (close)"
2020/09/06 11:53:38 [TRACE] dag/walk: upstream errored, not walking "root"
2020/09/06 11:53:38 [DEBUG] plugin: waiting for all plugin processes to complete...
2020-09-06T11:53:38.497+0200 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2020-09-06T11:53:38.501+0200 [DEBUG] plugin.terraform-provider-hcloud_v1.15.0_x4.exe: 2020/09/06 11:53:38 [ERR] plugin:
plugin server: accept tcp 127.0.0.1:10001: use of closed network connection
...
Error: rpc error: code = Unavailable desc = transport is closing

0.12.29:

data.hetznerdns_zone.dns_zone: Refreshing state...                                                                                                                                                                                  
                                                                                                                                                                                                                                    
Warning: Interpolation-only expressions are deprecated                                                                                                                                                                              
                                                                                                                                                                                                                                    
  on 15_providers.tf line 14, in provider "hcloud":                                                                                                                                                                                 
  14:   token = "${var.hcloud_token}"                                                                                                                                                                                               
                                                                                                                                                                                                                                    
Terraform 0.11 and earlier required all non-constant expressions to be                                                                                                                                                              
provided via interpolation syntax, but this pattern is now deprecated. To                                                                                                                                                           
silence this warning, remove the "${ sequence from the start and the }"                                                                                                                                                             
sequence from the end of this expression, leaving just the inner expression.                                                                                                                                                        
                                                                                                                                                                                                                                    
Template interpolation syntax is still used to construct strings from                                                                                                                                                               
expressions when the template includes multiple interpolation sequences or a                                                                                                                                                        
mixture of literal strings and interpolations. This deprecation applies only                                                                                                                                                        
to templates that consist entirely of a single interpolation sequence.                                                                                                                                                              
                                                                                                                                                                                                                                    
(and opanic: runtime error: invalid memory address or nil pointer dereference                                                                                                                                                       
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: [signal 0xc0000005 code=0x0 addr=0x18 pc=0xd4ef12]                                                                                            
n2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:                                                                                                                                              
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: goroutine 66 [running]:                                                                                                                       
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/timohirt/terraform-provider-hetznerdns/hetznerdns.dataSourceHetznerDNSZoneRead(0xc0002920e0, 0xf444e0, 0xc0000907e0, 0xc0002920e0, 
e2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/work/terraform-provider-hetznerdns/terraform-provider-hetznerdns/hetznerdns/data_source_zone.go:40 +0x162                      
 2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).ReadDataApply(0xc0004567e0, 0xc000694980, 0xf444e0, 0xc0000907e0, 0xc0005
, 0x0)                                                                                                                                                                                                                              
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.12.0/helper/schema/resource.go:403 +0x8f                               
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).ReadDataApply(0xc0000ae880, 0xc0003a1ad0, 0xc000694980, 0xc000694980, 0x0,
o2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.12.0/helper/schema/provider.go:451 +0x96                               
r2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadDataSource(0xc00008e4c8, 0x11d3340, 0xc0001e8120, 
00, 0xc00008e4c8, 0xc0001e8120, 0xc0005c3b78)                                                                                                                                                                                       
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.12.0/internal/helper/plugin/grpc_provider.go:1036 +0x464               
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadDataSource_Handler(0xf502e0, 0xc00008e4c8, 0x11d3340, 0xc0001e8120,
 660, 0x0, 0x11d3340, 0xc0001e8120, 0xc0002030e0, 0x30)                                                                                                                                                                             
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   s/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.12.0/internal/tfplugin5/tfplugin5.pb.go:3341 +0x21e                   
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000644900, 0x11dd780, 0xc000645380, 0xc0005da000, 0xc00017ef00, 0x189fb50, 0x0, 0x0, 0x0) 
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:1024 +0x508                                                                
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).handleStream(0xc000644900, 0x11dd780, 0xc000645380, 0xc0005da000, 0x0)                                       
m2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:1313 +0xd44                                                                
i2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00056c160, 0xc000644900, 0x11dd780, 0xc000645380, 0xc0005da000)                     
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   l/home/runner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:722 +0xa8                                                                 
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: created by google.golang.org/grpc.(*Server).serveStreams.func1                                                                                
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:720 +0xa8                                                                  
2020/09/06 12:00:45 [ERROR] <root>: eval: *terraform.EvalReadData, err: rpc error: code = Unavailable desc = transport is closing                                                                                                   
r2020/09/06 12:00:45 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing                                                                                                  
2020/09/06 12:00:45 [TRACE] [walkRefresh] Exiting eval tree: data.hetznerdns_zone.dns_zone                                                                                                                                          
2020/09/06 12:00:45 [TRACE] vertex "data.hetznerdns_zone.dns_zone": visit complete                                                                                                                                                  
 2020/09/06 12:00:45 [TRACE] vertex "data.hetznerdns_zone.dns_zone": dynamic subgraph encountered errors                                                                                                                            
2020/09/06 12:00:45 [TRACE] vertex "data.hetznerdns_zone.dns_zone": visit complete                                                                                                                                                  
2020/09/06 12:00:45 [TRACE] dag/walk: upstream of "provider.hetznerdns (close)" errored, so skipping                                                                                                                                
w2020/09/06 12:00:45 [TRACE] dag/walk: upstream of "root" errored, so skipping                                                                                                                                                      
2020/09/06 12:00:45 [TRACE] statemgr.Filesystem: removing lock metadata file terraform.tfstate.d\production\.terraform.tfstate.lock.info                                                                                            
2020/09/06 12:00:45 [TRACE] statemgr.Filesystem: unlocked by closing terraform.tfstate.d\production\terraform.tfstate                                                                                                               
2020-09-06T12:00:45.832+0200 [DEBUG] plugin: plugin exited                                                                                                                                                                          
                                                                                                                                                                                                                                    
rning elsewhere)  
...
Error: rpc error: code = Unavailable desc = transport is closing                                                                                                                                                                                                                  

0.13.1:

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.hetznerdns_zone.dns_zone: Refreshing state...

Warning: Interpolation-only expressions are deprecated

  on 15_providers.tf line 14, in provider "hcloud":
  14:   token = "${var.hcloud_token}"

Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.

Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.

(and opanic: runtime error: invalid memory address or nil pointer dereference
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: [signal 0xc0000005 code=0x0 addr=0x18 pc=0xd4ef12]
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: goroutine 51 [running]:
n2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/timohirt/terraform-provider-hetznerdns/hetznerdns.dataSourceHetznerDNSZoneRead(0xc00038e070, 0xf444e0, 0xc0005285c0, 0xc00038e070, 0x0)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   e/home/runner/work/terraform-provider-hetznerdns/terraform-provider-hetznerdns/hetznerdns/data_source_zone.go:40 +0x162
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).ReadDataApply(0xc000456750, 0xc00020c220, 0xf444e0, 0xc0005285c0, 0xc0004fe7d8, 0x1, 0x0)
 2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.12.0/helper/schema/resource.go:403 +0x8f
m2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).ReadDataApply(0xc00020e900, 0xc000297ad0, 0xc00020c220, 0xc00020c220, 0x0, 0x0)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   o/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.12.0/helper/schema/provider.go:451 +0x96
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadDataSource(0xc00020a4b8, 0x11d3340, 0xc00058a030, 0xc00064c040, 0xc00020a4b8, 0xc00058a030, 0xc00023fb78)
r2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.12.0/internal/helper/plugin/grpc_provider.go:1036 +0x464
e2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadDataSource_Handler(0xf502e0, 0xc00020a4b8, 0x11d3340, 0xc00058a030, 0xc0002081e0, 0x0, 0x11d3340, 0xc00058a030, 0xc00002e690, 0x30)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.12.0/internal/tfplugin5/tfplugin5.pb.go:3341 +0x21e
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000434c00, 0x11dd780, 0xc000584600, 0xc000300000, 0xc000115080, 0x189fb50, 0x0, 0x0, 0x0)
s2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:1024 +0x508
i2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).handleStream(0xc000434c00, 0x11dd780, 0xc000584600, 0xc000300000, 0x0)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   m/home/runner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:1313 +0xd44
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000206180, 0xc000434c00, 0x11dd780, 0xc000584600, 0xc000300000)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:722 +0xa8
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: created by google.golang.org/grpc.(*Server).serveStreams.func1
l2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:720 +0xa8
a2020/09/06 12:04:56 [ERROR] eval: *terraform.evalReadDataRefresh, err: rpc error: code = Unavailable desc = transport is closing
2020/09/06 12:04:56 [ERROR] eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/09/06 12:04:56 [TRACE] [walkRefresh] Exiting eval tree: data.hetznerdns_zone.dns_zone
r2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone": visit complete
2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone": dynamic subgraph encountered errors
2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone": visit complete
 2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone (expand)": dynamic subgraph encountered errors
2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone (expand)": visit complete
2020/09/06 12:04:56 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/timohirt/hetznerdns\"] (close)" errored, so skipping
w2020/09/06 12:04:56 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/09/06 12:04:56 [TRACE] statemgr.Filesystem: removing lock metadata file terraform.tfstate.d\production\.terraform.tfstate.lock.info
2020/09/06 12:04:56 [TRACE] statemgr.Filesystem: unlocked by closing terraform.tfstate.d\production\terraform.tfstate
a2020-09-06T12:04:56.139+0200 [DEBUG] plugin: plugin process exited: path=.terraform/plugins/registry.terraform.io/timohirt/hetznerdns/1.1.0/windows_amd64/terraform-provider-hetznerdns_v1.1.0.exe pid=6200 error="exit status 2"
2020-09-06T12:04:56.139+0200 [DEBUG] plugin: plugin exited

rning elsewhere)
...
Error: rpc error: code = Unavailable desc = transport is closing
@timohirt
Copy link
Owner

timohirt commented Sep 6, 2020

Hey @c33s, thanks for reporting this issue. Please share your Terraform code or share an example which helps me to reproduce the bug.

@c33s
Copy link
Author

c33s commented Sep 6, 2020

it's only some minimal example code (this is the actual code i try to run):

terraform {
  required_providers {
    hcloud = {
      source = "hetznercloud/hcloud"
      version = "1.20.1"
    }
    hetznerdns = {
      source = "timohirt/hetznerdns"
      version = "1.1.0"
    }
  }
}
provider "hcloud" {
  token = "${var.hcloud_token}"
//  token = var.hcloud_token
}
provider "hetznerdns" {
//  apitoken = var.hcloud_dns_token
  apitoken = "${var.hcloud_dns_token}"
}
data "hetznerdns_zone" "dns_zone" {
    name = "example.com"
}
resource "hcloud_server" "node1" {
  name = "node1"
  image = "debian-9"
  server_type = "cx11"
}

@LKaemmerling
Copy link

@timohirt i just looked into the code, i think i found the problem:
https://github.com/timohirt/terraform-provider-hetznerdns/blob/main/hetznerdns/data_source_zone.go#L34

GetZoneByName returns nil,nil when the zone (example.com in the same above) does not exist.

Within the datasource you only check if there is no error:
https://github.com/timohirt/terraform-provider-hetznerdns/blob/main/hetznerdns/data_source_zone.go#L35

	zone, err := client.GetZoneByName(name.(string))
	if err != nil {
		d.SetId("")
		return fmt.Errorf("Error getting zone state. %s", err)
	}

You should check if zone != nil too. Then the nil-point should be fixed.

(I just did a short look as @c33s asked me to do so.)

@c33s
Copy link
Author

c33s commented Sep 7, 2020

@LKaemmerling thanks you very much.

+facepalm+ i just copied the example from the provider and had not recognized that it iss a datasource and no resource item. i debugged everywhere but not the example code as i thought it's a copy and paste working code xD

@c33s c33s changed the title Plugin crashes with multiple versions of terraform Plugin crashes accessing a not existing zone via datasource Sep 7, 2020
@timohirt
Copy link
Owner

timohirt commented Sep 7, 2020

@LKaemmerling thanks for looking into this issue. Handled nil as you proposed.

@c33s next time you will see a proper error message:

Error: DNS zone 'example.de' doesn't exist

  on main.tf line 1, in data "hetznerdns_zone" "zone1":
   1: data "hetznerdns_zone" "zone1" {

@timohirt timohirt self-assigned this Sep 7, 2020
@timohirt timohirt added the bug Something isn't working label Sep 7, 2020
@timohirt
Copy link
Owner

timohirt commented Sep 7, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants