terraform-provider-citrixadc icon indicating copy to clipboard operation
terraform-provider-citrixadc copied to clipboard

RNAT object and netscaler 13 = Terraform crash?

Open kyrian666 opened this issue 3 years ago • 5 comments

Hi,

Just plodding through more work on this (maybe adding this bug with the wrong username though) and I am starting to get the impression that netscaler 13's deprecation of the 'natIP' parameter to 'set rnat' and 'add rnat' has caused a compatibility problem with this terraform provider?

I've looked for other causes but narrowed it down to even when I apply just this one object it crashes out terraform, within this provider somehow.

When I apply the config from the old device on the netscaler command line I get:

Warning: Argument deprecated [natIP]

And with terraform code, redacted for obvious reasons:

resource "citrixadc_rnat" "rnat-nat-box" { count = var.box_count

rnatsname = "nat_box${lookup(data.null_data_source.variables.inputs, "lookup_thing")}0${count.index+1}" rnat { natip = "9X.19Y.4Z.25Q" }

depends_on = [ citrixadc_lbvserver.other-test-object ] }

Resulting error mostly comes out like this:

2021-04-27T16:49:26.612+0100 [WARN] plugin.stdio: received EOF, stopping recv l oop: err="rpc error: code = Unavailable desc = transport is closing"

So I am thinking perhaps the warning handling causes problems with the TF provider, and wondering if it can be confirmed that this ought to work, or not?

K.

kyrian666 avatar Apr 27 '21 16:04 kyrian666

This terraform trace might help, particularly the first line I suspect:

panic: interface conversion: interface {} is nil, not string 2021-04-28T09:38:00.359+0100 [DEBUG] plugin.terraform-provider-citrixadc: 2021-04-28T09:38:00.359+0100 [DEBUG] plugin.terraform-provider-citrixadc: goroutine 57 [running]: 2021-04-28T09:38:00.359+0100 [DEBUG] plugin.terraform-provider-citrixadc: github.com/citrix/terraform-provider-citrixadc/citrixadc.updateRnatsFunc(0xc0004ffc70, 0xf1fc20, 0xc0003a0980, 0x24, 0x181bda0) 2021-04-28T09:38:00.359+0100 [DEBUG] plugin.terraform-provider-citrixadc: /home/georgen/Downloads/repos/terraform-provider-citrixadc/citrixadc/resource_citrixadc_rnat.go:142 +0x839 2021-04-28T09:38:00.359+0100 [DEBUG] plugin.terraform-provider-citrixadc: github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc00064c680, 0xc00008aa00, 0xc000052d00, 0xf1fc20, 0xc0003a0980, 0xf8da01, 0xc0003a8698, 0xc000722ff0) 2021-04-28T09:38:00.359+0100 [DEBUG] plugin.terraform-provider-citrixadc: /home/georgen/Downloads/repos/terraform-provider-citrixadc/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:311 +0x273 2021-04-28T09:38:00.359+0100 [DEBUG] plugin.terraform-provider-citrixadc: github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc0001a1100, 0xc0007458d8, 0xc00008aa00, 0xc000052d00, 0xc0006aace8, 0xc00000e2b0, 0xf8fa20) 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: /home/georgen/Downloads/repos/terraform-provider-citrixadc/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:289 +0x99 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00064e110, 0x128f510, 0xc00063fa10, 0xc00013f560, 0xc00064e110, 0xc00063fa10, 0xc000732a50) 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: /home/georgen/Downloads/repos/terraform-provider-citrixadc/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:885 +0x8ac 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: github.com/hashicorp/terraform/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1071020, 0xc00064e110, 0x128f510, 0xc00063fa10, 0xc00013f500, 0x0, 0x128f510, 0xc00063fa10, 0xc000150840, 0x154) 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: /home/georgen/Downloads/repos/terraform-provider-citrixadc/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go:3189 +0x214 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: google.golang.org/grpc.(*Server).processUnaryRPC(0xc00016a160, 0x1297798, 0xc00038aa80, 0xc000748800, 0xc0005467e0, 0x17d8b60, 0x0, 0x0, 0x0) 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: /home/georgen/Downloads/repos/terraform-provider-citrixadc/vendor/google.golang.org/grpc/server.go:995 +0x482 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: google.golang.org/grpc.(*Server).handleStream(0xc00016a160, 0x1297798, 0xc00038aa80, 0xc000748800, 0x0) 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: /home/georgen/Downloads/repos/terraform-provider-citrixadc/vendor/google.golang.org/grpc/server.go:1275 +0xd2c 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00039c1e0, 0xc00016a160, 0x1297798, 0xc00038aa80, 0xc000748800) 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: /home/georgen/Downloads/repos/terraform-provider-citrixadc/vendor/google.golang.org/grpc/server.go:710 +0xab 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: created by google.golang.org/grpc.(*Server).serveStreams.func1 2021-04-28T09:38:00.360+0100 [DEBUG] plugin.terraform-provider-citrixadc: /home/georgen/Downloads/repos/terraform-provider-citrixadc/vendor/google.golang.org/grpc/server.go:708 +0xa5

PS. Before you ask...

    NetScaler NS13.0: Build 71.44.nc, Date: Dec 26 2020, 11:31:14   (64-bit)

kevgreen-ebay-com avatar Apr 28 '21 08:04 kevgreen-ebay-com

Our networks team say on the command line you can just omit '-natIP' and provide the IP address on its own, FWIW.

kevgreen-ebay-com avatar Apr 29 '21 08:04 kevgreen-ebay-com

I've tried this with network/netmask instead of natip and the crash appears the same.

kevgreen-ebay-com avatar Apr 29 '21 08:04 kevgreen-ebay-com

It seems that rnat has changed NITRO implementation between 12.1 and 13.0 version of ADC.

We will have to rewrite the resource to be compatible with the new implementation.

giorgos-nikolopoulos avatar May 06 '21 13:05 giorgos-nikolopoulos

Just to confirm the curl based workaround does not seem to apply here, it too rejects requests with natIP, or with network/netmask instead.

kevgreen-ebay-com avatar May 25 '21 09:05 kevgreen-ebay-com

Hello, We have updated the citrixadc_rnat resource to support the Latest ADC version. Refer here for documentation on rnat. We have created new resource citrixadc_rnat_clear which support clear operation. Which is similar to older terraform provider of rnat. Refer here for documentation on rnat_clear.

rohit-myali avatar Nov 15 '22 14:11 rohit-myali