From 83a795f13c85be38a239b405e1c614e5242e9e3e Mon Sep 17 00:00:00 2001 From: BingWu Date: Wed, 22 Jun 2022 12:49:11 +0800 Subject: [PATCH 1/2] fix bug terraform import citrixadc_route Signed-off-by: Bing Wu --- citrixadc/resource_citrixadc_route.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/citrixadc/resource_citrixadc_route.go b/citrixadc/resource_citrixadc_route.go index da3ac97c9..6b6959caa 100644 --- a/citrixadc/resource_citrixadc_route.go +++ b/citrixadc/resource_citrixadc_route.go @@ -1,6 +1,8 @@ package citrixadc import ( + "strings" + "github.com/citrix/adc-nitro-go/resource/config/network" "github.com/citrix/adc-nitro-go/service" @@ -216,7 +218,14 @@ func updateRouteFunc(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] citrixadc-provider: In updateRouteFunc") client := meta.(*NetScalerNitroClient).client routeName := d.Id() - + if routeName != "" { + ip_net_gate := strings.Split(routeName, "__") + if len(ip_net_gate) == 3 { + d.Set("network", ip_net_gate[0]) + d.Set("netmask", ip_net_gate[1]) + d.Set("gateway", ip_net_gate[2]) + } + } route := network.Route{} hasChange := false if d.HasChange("advertise") { From 4e69e14b400dd35b39b6612340592e9f8289554f Mon Sep 17 00:00:00 2001 From: BingWu Date: Wed, 22 Jun 2022 12:50:39 +0800 Subject: [PATCH 2/2] fix bug terraform import citrixadc_route Signed-off-by: Bing Wu --- citrixadc/resource_citrixadc_route.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/citrixadc/resource_citrixadc_route.go b/citrixadc/resource_citrixadc_route.go index 6b6959caa..938b6676f 100644 --- a/citrixadc/resource_citrixadc_route.go +++ b/citrixadc/resource_citrixadc_route.go @@ -146,7 +146,14 @@ func readRouteFunc(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] citrixadc-provider: In readRouteFunc") client := meta.(*NetScalerNitroClient).client routeName := d.Id() - + if routeName != "" { + ip_net_gate := strings.Split(routeName, "__") + if len(ip_net_gate) == 3 { + d.Set("network", ip_net_gate[0]) + d.Set("netmask", ip_net_gate[1]) + d.Set("gateway", ip_net_gate[2]) + } + } log.Printf("[DEBUG] citrixadc-provider: Reading route state %s", routeName) findParams := service.FindParams{ ResourceType: service.Route.Type(),