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

[BUG] Imports missing data #1126

Closed
gusmb opened this issue Mar 14, 2024 · 7 comments · Fixed by #1133
Closed

[BUG] Imports missing data #1126

gusmb opened this issue Mar 14, 2024 · 7 comments · Fixed by #1133
Assignees
Labels
bug In-Progress ..being worked upon

Comments

@gusmb
Copy link

gusmb commented Mar 14, 2024

Contact us

For any immediate issues or help , reach out to us at [email protected] !

Bug Report

Importing existing resources is important for me as I need to reconciliate resources that might have been configured before manually.
I found that most of the resources I tried to import where missing all the bindings and a few more params after importing, causing terraform apply to fail. The impacted resource types are:

  • lbvserver
  • service
  • servicegroup

Missing params after importing:

lbvserver

  • clttimeout

service

  • maxclient
  • maxreq
  • lbvserver bound the service

servicegroup

  • maxclient
  • maxreq
  • lbvserver bound the service
  • lbmonitor bound to the service group
  • servicegroupmembers bindings

To Reproduce
Steps to reproduce the behaviour:

  1. My terraform files are
terraform {
  backend "local" {
    path = "terraform.tfstate"
  }
  required_providers {
    citrixadc = {
      source  = "citrix/citrixadc"
      version = "~> 1.37.0"
    }
  }
}
 
provider "citrixadc" {
  endpoint             = https://10.10.199.59
  insecure_skip_verify = true
  do_login             = true
  partition            = "Tenant1"
}
 
resource "citrixadc_server" "server1" {
  name      = "server1"
  ipaddress = "10.82.197.237"
  state     = "ENABLED"
 
}
resource "citrixadc_server" "server2" {
  name      = "server2"
  ipaddress = "10.82.197.238"
  state     = "ENABLED"
 
}
resource "citrixadc_lbvserver" "app-slb-80" {
  ipv46           = "10.30.1.1"
  port            = 80
  state           = "ENABLED"
  lbmethod        = "LEASTCONNECTION"
  servicetype     = "TCP"
  timeout         = 2
  clttimeout      = 300
  name            = "V_APP_80"
  persistencetype = "SOURCEIP"
 
}
resource "citrixadc_lbvserver" "app-slb-443" {
  ipv46           = "10.30.1.1"
  port            = 443
  state           = "ENABLED"
  lbmethod        = "LEASTCONNECTION"
  servicetype     = "SSL_BRIDGE"
  timeout         = 2
  clttimeout      = 300
  name            = "V_APP_443"
  persistencetype = "SOURCEIP"
 
}
resource "citrixadc_lbmonitor" "app-monitor-tcp" {
  type        = "TCP"
  monitorname = "M_APP_80_TCP"
  state       = "ENABLED"
  interval    = "5"
  resptimeout = "2"
  destport    = 80
  units2      = "SEC"
  units3      = "SEC"
  units4      = "SEC"
  lrtm        = "DISABLED"
  retries     = 3
  downtime    = 30
 
}
resource "citrixadc_lbmonitor" "app-monitor-http-server1" {
  type        = "HTTP"
  monitorname = "M_SERVER1_443_HTTP"
  state       = "ENABLED"
  interval    = "5"
  resptimeout = "2"
  destport    = 443
  units2      = "SEC"
  units3      = "SEC"
  units4      = "SEC"
  lrtm        = "DISABLED"
  retries     = 3
  downtime    = 30
  secure      = "YES"
  httprequest = "GET /health HTTP/1.1\r\nHost: server1\r\nConnection: Close\r\n\r\n"
 
}
resource "citrixadc_lbmonitor" "app-monitor-http-server2" {
  type        = "HTTP"
  monitorname = "M_SERVER2_443_HTTP"
  state       = "ENABLED"
  interval    = "5"
  resptimeout = "2"
  destport    = 443
  units2      = "SEC"
  units3      = "SEC"
  units4      = "SEC"
  lrtm        = "DISABLED"
  retries     = 3
  downtime    = 30
  secure      = "YES"
  httprequest = "GET /health HTTP/1.1\r\nHost: server2\r\nConnection: Close\r\n\r\n"
 
}
resource "citrixadc_service" "app-https-pool-server1-443" {
  name          = "SVC_APP_SERVER1_443"
  servicetype   = "SSL_BRIDGE"
  servername    = "server1"
  port          = 443
  state         = "ENABLED"
  lbvserver     = "V_APP_443"
  lbmonitor     = "M_SERVER1_443_HTTP"
  healthmonitor = "YES"
  maxclient     = 0
  maxreq        = 0
  cip           = "ENABLED"
  usip          = "YES"
  useproxyport  = "NO"
  sp            = "ON"
  clttimeout    = 9000
  svrtimeout    = 9000
  cka           = "NO"
  tcpb          = "NO"
  cmp           = "NO"
  cipheader     = "X-Forwarded-For"
 
  depends_on = [citrixadc_lbvserver.app-slb-443, citrixadc_lbmonitor.app-monitor-http-server1]
}
resource "citrixadc_service" "app-https-pool-server2-443" {
  name          = "SVC_APP_SERVER2_443"
  servicetype   = "SSL_BRIDGE"
  servername    = "server2"
  port          = 443
  state         = "ENABLED"
  lbvserver     = "V_APP_443"
  lbmonitor     = "M_SERVER2_443_HTTP"
  healthmonitor = "YES"
  maxclient     = 0
  maxreq        = 0
  cip           = "ENABLED"
  usip          = "YES"
  useproxyport  = "NO"
  sp            = "ON"
  clttimeout    = 9000
  svrtimeout    = 9000
  cka           = "NO"
  tcpb          = "NO"
  cmp           = "NO"
  cipheader     = "X-Forwarded-For"
 
  depends_on = [citrixadc_lbvserver.app-slb-443, citrixadc_lbmonitor.app-monitor-http-server2]
}
resource "citrixadc_servicegroup" "app-http-pool-80" {
  servicegroupname                  = "SVG_APP_80"
  servicetype                       = "TCP"
  state                             = "ENABLED"
  lbvservers                        = ["V_APP_80"]
  lbmonitor                         = "M_APP_80_TCP"
  healthmonitor                     = "YES"
  servicegroupmembers_by_servername = ["server1:80:1", "server2:80:1"]
  maxclient                         = 0
  maxreq                            = 0
  cip                               = "DISABLED"
  usip                              = "NO"
  useproxyport                      = "NO"
  sp                                = "ON"
  clttimeout                        = 9000
  svrtimeout                        = 9000
  cka                               = "NO"
  tcpb                              = "NO"
  cmp                               = "NO"
  autoscale                         = "DISABLED"
 
  depends_on = [citrixadc_lbvserver.app-slb-80, citrixadc_lbmonitor.app-monitor-tcp, citrixadc_server.server1, citrixadc_server.server2]
}
  1. which terraform command I am getting the error
terraform apply

Expected behaviour
After re-importing resources after deleting the state files and running terraform init, expected behavior would be no changes reported after running a terraform plan

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please fill the following information):

  • OS: Linux
  • terraform version 1.37.0
  • terraform-provider-citrixadc 2.5.0
  • go version 1.21.3

Additional context
Add any other context about the problem here.

@gusmb
Copy link
Author

gusmb commented Mar 14, 2024

@sumanth-lingappa FYI, dropped you and email with additional details

@rohit-myali
Copy link
Contributor

Hi @gusmb
Can you past the error that you are facing?

@gusmb
Copy link
Author

gusmb commented Mar 31, 2024

Hi @gusmb Can you past the error that you are facing?

It is not an error per se. However the state is incomplete on import as per the issue description. To reproduce, I manually deleted the state and then ran the imports. after the imports were completed, the state was missing the params indicated in the description

@rohit-myali
Copy link
Contributor

Sure Thanks, I got it. I will update you on this!

@rohit-myali rohit-myali added bug In-Progress ..being worked upon labels Apr 5, 2024
@rohit-myali
Copy link
Contributor

rohit-myali commented Apr 5, 2024

Hello @gusmb
We recomend you to use individual resource for binding, Example: To bind lbvserver to service, instead of using above method, use citrixadc_lbvserver_service_binding resource. So, that the importing will be well handled.
Also, we are not supporting above mentioned approach to any of the other resources.

If you are using the above method (that you mentioned in your configuration), then we can't resolve the import issue for attributes that are for binding. We have fixed issue for the other attributes above mentioned, except for binding. I will update you on this, after it is released to terraform registry.

@gusmb
Copy link
Author

gusmb commented Apr 5, 2024

Hello @gusmb We recomend you to use individual resource for binding, Example: To bind lbvserver to service, instead of using above method, use citrixadc_lbvserver_service_binding resource. So, that the importing will be well handled. Also, we are not supporting above mentioned approach to any of the other resources.

If you are using the above method (that you mentioned in your configuration), then we can't resolve the import issue for attributes that are for binding. We have fixed issue for the other attributes above mentioned, except for binding. I will update you on this, after it is released to terraform registry.

Thanks for the update, If that is not the way forward I'll change everything to explicit bindings instead. Also, I don't see the point o. Supporting the implicit bindings if it breaks these kind of functionality

sumanth-lingappa added a commit that referenced this issue Apr 17, 2024
fixes #1126 
Updated read func to convert certain attributes from string to int...
@rohit-myali
Copy link
Contributor

Hello @gusmb
Thanks for your patience.
We have worked on this and and it is now available in the terraform registry. Please download the latest terraform-provider-citrixadc version v1.38.0.

@rohit-myali rohit-myali self-assigned this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug In-Progress ..being worked upon
Projects
None yet
2 participants