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

When setting timeout to 0 on citrixadc_lbvserver , provider says successful but the value is set to default: 2 on netscaler #101

Closed
BraddMPiontek opened this issue Jun 1, 2020 · 4 comments
Assignees

Comments

@BraddMPiontek
Copy link

BraddMPiontek commented Jun 1, 2020

Describe the bug
We are trying to set the timeout value to 0 (persistence never times out unless browser is closed). When running apply, the plan is applied successfully but running additional plans shows that terraform wants to change value from 2 to 0.

To Reproduce

  • Create a citrixadc_lbvserver resource with timeout = "0"
  • Run tfm plan, tfm apply. Note the lbvserver is created successfully
  • Either inspect the state or run another plan. Terraform will want to change the value from 2 -> 0
  • Verify on the netscaler, the value is 2, not 0.

Expected behavior
The value on the netscaler lbvserver should be set to 0.

Logs
From citrixadc 12.1:
this is setting it from 1440 -> 0. (existing lbvserver)
I can set it fine to 2 or any value > than that

2020-06-01T16:32:54.001-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.21: 2020/06/01 16:32:54 [DEBUG] go-nitro: response Status: 400 Bad Request
2020-06-01T16:32:54.001-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.21: 2020/06/01 16:32:54 [INFO] go-nitro: error = { "errorcode": 1094, "message": "Too few arguments", "severity": "ERROR" }

Environment (please complete the following information):

  • OS: MacOS Catalina, Linux
  • Provider version: v0.12.21
  • Terraform version: v0.11.10
  • Citrix ADC version: 11.1 and 12.1 (I need to verify it is repeatable in both)

Additional context
It is unclear to me if this is a bug in the provider, or downstream in the go-nitro library being used.

@devopsjedi
Copy link

Try running with TF_LOG=DEBUG and you should see the JSON payload that is used by go-nitro

@BraddMPiontek
Copy link
Author

BraddMPiontek commented Oct 27, 2020

2020-10-27T12:54:18.337-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.35: 2020/10/27 12:54:18 [TRACE] go-nitro: url is  https://nhqnscab5a.amfam.com/nitro/v1/config/lbvserver/auto-tpswebteam-eng-blue-vip-SSL-443
2020-10-27T12:54:18.337-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.35: 2020/10/27 12:54:18 [TRACE] go-nitro: doHTTPRequest HTTP method: PUT
2020-10-27T12:54:18.337-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.35: 2020/10/27 12:54:18 [TRACE] go-nitro: doHTTPRequest HTTP url: https://nhqnscab5a.amfam.com/nitro/v1/config/lbvserver/auto-tpswebteam-eng-blue-vip-SSL-443
2020-10-27T12:54:18.337-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.35: 2020/10/27 12:54:18 [TRACE] go-nitro: doHTTPRequest HTTP body: {"lbvserver":{"name":"auto-tpswebteam-eng-blue-vip-SSL-443"}}
2020-10-27T12:54:18.435-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.35: 2020/10/27 12:54:18 [DEBUG] go-nitro: response Status: 400 Bad Request
2020-10-27T12:54:18.435-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.35: 2020/10/27 12:54:18 [INFO] go-nitro: error = { "errorcode": 1094, "message": "Too few arguments", "severity": "ERROR" }
2020/10/27 12:54:18 [TRACE] root.netscaler_blue: eval: *terraform.EvalWriteState

Here is the output from me changing the lb_persistence_timeout from '1444' to '10'
note that the timeout is part of the json.

2020-10-27T13:30:57.571-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.35: 2020/10/27 13:30:57 [DEBUG] go-nitro: UpdateResource: Resourcejson is {"lbvserver":{"name":"auto-tpswebteam-eng-blue-vip-SSL-443","timeout":10}}
2020-10-27T13:30:57.571-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.35: 2020/10/27 13:30:57 [DEBUG] go-nitro: Updating resource of type  lbvserver

I would like to note that Citrix recommends a value of '0' for COOKIEINSERT, which is what all of our load-balancer configs used until we started automating this via terraform.

Now changing it from '10' to '0' (same result as 1440 to 0, an error)

2020-10-27T13:36:34.171-0500 [DEBUG] plugin.terraform-provider-citrixadc_v0.12.35: 2020/10/27 13:36:34 [DEBUG] go-nitro: UpdateResource: Resourcejson is {"lbvserver":{"name":"auto-tpswebteam-eng-blue-vip-SSL-443"}}

@BraddMPiontek
Copy link
Author

I think the issue is with the GO Nitro package being used;

https://github.com/chiradeep/go-nitro/blob/master/config/lb/lbvserver.go#L125

omitempty for JSON in GO and an int datatype will omit the value from the JSON if the value is the default for an int "0". but 0 is a valid value in the API.

@BraddMPiontek
Copy link
Author

This is an issue with the go-nitro api. chiradeep/go-nitro#44

I have forked that repo and built this provider with my forked go-nitro to verify it allows us to set a value of '0'. The permanent fix, however, is a bit out of my skillset when it comes to Go .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants