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]: citrixadc_lbvserver not allowed to create IP address type non addressable #1220

Open IvoFulcoTR opened 1 month ago

IvoFulcoTR commented 1 month ago

Terraform Core Version

v1.10.0-alpha20240926

citrixadc Provider Version

v1.41.0

Operating system

Windows 11

Affected Resource(s)

citrixadc_cspolicy

Equivalent NetScaler CLI Command

add lb vserver HTTP 0.0.0.0 80 -lbMethod LEASTCONNECTION

Expected Behavior

Resources created with success, a virtual server with non addressable

Actual Behavior

Error: Provider produced inconsistent result after apply │ │ When applying changes to citrixadc_lbvserver_service_binding.lb_vserver_service_binding, provider "provider[\"registry.terraform.io/citrix/citrixadc\"]" produced an unexpected new value: Root object was │ present, but now absent. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵ ╷ │ Error: [ERROR] netscaler-provider: Specified Action lb_vserver_ws does not exist │ │ with citrixadc_cspolicy.ws_cspolicy, │ on main.tf line 44, in resource "citrixadc_cspolicy" "ws_cspolicy": │ 44: resource "citrixadc_cspolicy" "ws_cspolicy" {

Relevant Error/Panic Output Snippet

# Create an action in the Content Switch pointing to the virtual server
resource "citrixadc_cspolicy" "ws_cspolicy" {
  policyname = "ws_cs_action"
  rule       = "HTTP.REQ.HOSTNAME.EQ(\"mylink-for-instance.mysite.com\")"
  action     = citrixadc_lbvserver.ws_lb_vserver.name # Action points to the created vServer
}

Terraform Configuration Files

terraform { required_providers { citrixadc = { source = "citrix/citrixadc" version = "~> 1.41" } } } provider "citrixadc" { username = "root" password = "mysecret" endpoint = "http://10.10.1.1" }

Create a server in Citrix ADC

resource "citrixadc_server" "ws_server" { name = "ws_10.56.26.171" ipaddress = "10.56.26.171" }

Create a service group associated with the ws_server

resource "citrixadc_servicegroup" "tf_servicegroup" { servicegroupname = "tf_servicegroup" servicetype = "HTTP" }

resource "citrixadc_servicegroup_servicegroupmember_binding" "tf_service" { servicegroupname = citrixadc_servicegroup.tf_servicegroup.servicegroupname ip = "10.56.26.173" port = 8522 }

Create a non-addressable virtual server (without IP) in the existing VM

resource "citrixadc_lbvserver" "ws_lb_vserver" { name = "lb_vserver_ws" servicetype = "HTTP"

port = 80

ipset = true # This ensures that the LB vServer does not have an assignable IP

lbmethod = "LEASTCONNECTION"

ipv46 = "0.0.0.0" }

Bind the service to the virtual server

resource "citrixadc_lbvserver_service_binding" "lb_vserver_service_binding" { name = citrixadc_lbvserver.ws_lb_vserver.name servicename = citrixadc_servicegroup.tf_servicegroup.servicegroupname }

Create an action in the Content Switch pointing to the virtual server

resource "citrixadc_cspolicy" "ws_cspolicy" { policyname = "ws_cs_action" rule = "HTTP.REQ.HOSTNAME.EQ(\"mylink-for-instance.mysite.com\")" action = citrixadc_lbvserver.ws_lb_vserver.name # Action points to the created vServer }

Create a policy in the Content Switch to use the newly created action

resource "citrixadc_csvserver" "ws_cs_vserver" { name = "cs_vserver_ws" servicetype = "HTTP" port = 80 ipv46 = "10.56.26.172" # Non-addressable Virtual Server }

Bind the policy to the Content Switch

resource "citrixadc_csvserver_cspolicy_binding" "cs_policy_binding" { name = citrixadc_csvserver.ws_cs_vserver.name policyname = citrixadc_cspolicy.ws_cspolicy.policyname priority = 100 }

Steps to Reproduce

copy all code and run this commands: terraform init terraform apply -auto-approve

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

https://registry.terraform.io/providers/citrix/citrixadc/latest/docs/resources/servicegroup_servicegroupmember_binding