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]: TF tries to change monitor type instead of destroying and creating new #1168

Closed Artlb closed 1 month ago

Artlb commented 6 months ago

Terraform Core Version

1.3.2

citrixadc Provider Version

1.36.0

Operating system

windows

Affected Resource(s)

citrixadc_lbmonitor

Equivalent NetScaler CLI Command

Primary> rm lb monitor mon-1234-test.com PING Primary> add lb monitor mon-1234-test.com tcp

Expected Behavior

When trying to change type of monitor (and keep the same name) from ie PING to TCP on ADC we need to remove existing monitor and create new one of new type. ADC is not allowing us to change type of existing monitor after creation

Actual Behavior

TF is just trying to change type of the monitor

Relevant Error/Panic Output Snippet

PLAN
 # citrixadc_lbmonitor.tf_lbmonitor_udp["1234-test.com"] will be updated in-place
  ~ resource "citrixadc_lbmonitor" "tf_lbmonitor_udp" {
        id                             = "mon-1234-test.com"
      ~ type                           = "PING" -> "TCP"
APPLY:
│ Error: [ERROR] netscaler-provider: Error updating lbmonitor mon-1234-test.com
│ 
│   with citrixadc_lbmonitor.tf_lbmonitor_udp["1234-test.com"],
│   on create_udp_services.tf line 52, in resource "citrixadc_lbmonitor" "tf_lbmonitor_udp":
│   52: resource "citrixadc_lbmonitor" "tf_lbmonitor_udp" {

Terraform Configuration Files

Create Service Group monitoring

resource "citrixadc_lbmonitor" "tf_lbmonitor_udp" { for_each = { for service in local.udp_servicemap: service.name => service } monitorname = "mon-${each.value.name}${each.value.nameSuffix}" lrtm = "DISABLED" type = each.value.MonitorType }

resource "citrixadc_servicegroup_lbmonitor_binding" "tf_binding_udp" { for_each = { for service in local.udp_servicemap: service.name => service } servicegroupname = citrixadc_servicegroup.tf_servicegroup_udp[each.value.name].servicegroupname monitorname = citrixadc_lbmonitor.tf_lbmonitor_udp[each.value.name].monitorname weight = 1 }

Steps to Reproduce

try changing type of existing monitor bind to existing service

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response