citrix / terraform-provider-citrixadc

Part of NetScaler Automation Toolkit | https://github.com/netscaler/automation-toolkit
https://registry.terraform.io/providers/citrix/citrixadc
Apache License 2.0
119 stars 59 forks source link

[Bug]: adding servicegroup with # symbol in the name produces an error #1180

Closed michalgcsg closed 2 months ago

michalgcsg commented 4 months ago

Terraform Core Version

1.9.1

citrixadc Provider Version

1.39.0

Operating system

Ubuntu 22.04.4 LTS

Affected Resource(s)

resource "citrixadc_servicegroup" "backend" { servicegroupname = "production#Backend" servicetype = "HTTP" }

Equivalent NetScaler CLI Command

The resource gets added: Jul 9 13:33:06 10.91.71.166 07/09/2024:13:33:06 GMT 0-PPE-0 : default API CMD_EXECUTED 2028757 0 : User nsroot - ADM_User NONE - Remote_ip 10.91.71.188 - Command "add serviceGroup production#Backend HTTP -td 0 -cacheable NO -pathMonitor NO -pathMonitorIndv NO -sp OFF -rtspSessionidRemap OFF -maxBandwidth 0 -state ENABLED -downStateFlush ENABLED -appflowLog ENABLED -memberPort 0 -autoDisablegraceful NO -autoDelayedTrofs NO -noDefaultBindings NO -devno 61898752" - Status "Success"

however to verify - the provided does issue the command to show servicegroup to validate the creation, which fails due to wrong name used:

Jul 9 13:33:06 10.91.71.166 07/09/2024:13:33:06 GMT 0-PPE-0 : default API CMD_EXECUTED 2028761 0 : User nsroot - ADM_User NONE - Remote_ip 10.91.71.188 - Command "show serviceGroup production" - Status "ERROR: No such resource"

Expected Behavior

resouce created successfully

Actual Behavior

Resource created, but with error.

Relevant Error/Panic Output Snippet

2024-07-09T13:33:09.900Z [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to citrixadc_servicegroup.backend, provider "provider[\"registry.terraform.io/citrix/citrixadc\"]" produced an unexpected n
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Terraform Configuration Files

resource "citrixadc_servicegroup" "backend" { servicegroupname = "production#Backend" servicetype = "HTTP" }

Steps to Reproduce

attempt to create the resource with # in the name

Debug Output

citrixadc_servicegroup.backend: Creating... 2024-07-09T13:33:09.862Z [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/citrix/citrixadc" is in the global cache 2024-07-09T13:33:09.862Z [INFO] Starting apply for citrixadc_servicegroup.backend 2024-07-09T13:33:09.862Z [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/citrix/citrixadc" is in the global cache 2024-07-09T13:33:09.862Z [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/citrix/citrixadc" is in the global cache 2024-07-09T13:33:09.862Z [DEBUG] citrixadc_servicegroup.backend: applying the planned Create change 2024-07-09T13:33:09.863Z [TRACE] GRPCProvider: ApplyResourceChange 2024-07-09T13:33:09.863Z [TRACE] GRPCProvider: GetProviderSchema 2024-07-09T13:33:09.864Z [DEBUG] provider.terraform-provider-citrixadc_v1.39.0: 2024/07/09 13:33:09 [DEBUG] netscaler-provider: In createServicegr 2024-07-09T13:33:09.881Z [DEBUG] provider.terraform-provider-citrixadc_v1.39.0: 2024/07/09 13:33:09 [DEBUG] netscaler-provider: In readServicegrou 2024-07-09T13:33:09.881Z [DEBUG] provider.terraform-provider-citrixadc_v1.39.0: 2024/07/09 13:33:09 [DEBUG] netscaler-provider: Reading servicegrou 2024-07-09T13:33:09.894Z [DEBUG] provider.terraform-provider-citrixadc_v1.39.0: 2024/07/09 13:33:09 [WARN] netscaler-provider: Clearing servicegrou 2024-07-09T13:33:09.895Z [TRACE] maybeTainted: citrixadc_servicegroup.backend encountered an error during creation, so it is now marked as tainted 2024-07-09T13:33:09.895Z [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/citrix/citrixadc" is in the global cache 2024-07-09T13:33:09.895Z [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for citrixadc_servicegroup.backend 2024-07-09T13:33:09.895Z [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for citrixadc_servicegroup.backend 2024-07-09T13:33:09.895Z [TRACE] evalApplyProvisioners: citrixadc_servicegroup.backend is tainted, so skipping provisioning 2024-07-09T13:33:09.895Z [TRACE] maybeTainted: citrixadc_servicegroup.backend was already tainted, so nothing to do 2024-07-09T13:33:09.895Z [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/citrix/citrixadc" is in the global cache 2024-07-09T13:33:09.895Z [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for citrixadc_servicegroup.backend 2024-07-09T13:33:09.895Z [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for citrixadc_servicegroup.backend 2024-07-09T13:33:09.895Z [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old 2024-07-09T13:33:09.895Z [TRACE] statemgr.Filesystem: no state changes since last snapshot 2024-07-09T13:33:09.895Z [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate 2024-07-09T13:33:09.899Z [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot 2024-07-09T13:33:09.899Z [ERROR] vertex "citrixadc_servicegroup.backend" error: Provider produced inconsistent result after apply 2024-07-09T13:33:09.899Z [TRACE] vertex "citrixadc_servicegroup.backend": visit complete, with errors 2024-07-09T13:33:09.899Z [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/citrix/citrixadc\"] (close)" errored, so skipping 2024-07-09T13:33:09.899Z [TRACE] dag/walk: upstream of "root" errored, so skipping 2024-07-09T13:33:09.900Z [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/citrix/citrixadc" is in the global cache 2024-07-09T13:33:09.900Z [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old 2024-07-09T13:33:09.900Z [TRACE] statemgr.Filesystem: no state changes since last snapshot 2024-07-09T13:33:09.900Z [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to citrixadc_servicegroup.backend, provider "provider[\"registry.terraform.io/citrix/citrixadc\"]" produced an unexpected n │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵ 2024-07-09T13:33:09.903Z [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info 2024-07-09T13:33:09.903Z [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock 2024-07-09T13:33:09.908Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from ser 2024-07-09T13:33:09.911Z [INFO] provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/citrix/citrixadc/1.39.0/linux_a 2024-07-09T13:33:09.911Z [DEBUG] provider: plugin exited

Panic Output

No response

Important Factoids

It is an issue constructing the nitro request to NetScaler - in the URL of the nitro call is truncated with the '#', so we are getting /nitro/v1/config/servicegroup/production, while the '#' should be encoded and we should have: /nitro/v1/config/servicegroup/production%23Backend

References

No response