From 15498fd1136cc0f06894c786abc21f1068099072 Mon Sep 17 00:00:00 2001 From: Martin Nygaard Jensen Date: Tue, 6 Aug 2024 11:49:10 +0000 Subject: [PATCH] Clears nsrpcnode if it has been manually deleted Signed-off-by: Martin Nygaard Jensen --- citrixadc/resource_citrixadc_nsrpcnode.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/citrixadc/resource_citrixadc_nsrpcnode.go b/citrixadc/resource_citrixadc_nsrpcnode.go index d7ee69d1e..56ce7975f 100644 --- a/citrixadc/resource_citrixadc_nsrpcnode.go +++ b/citrixadc/resource_citrixadc_nsrpcnode.go @@ -96,6 +96,13 @@ func readNsrpcnodeFunc(d *schema.ResourceData, meta interface{}) error { return nil } + if len(dataArray) == 0 { + log.Printf("[DEBUG] citrixadc-provider: Failed to find nsrpcnode %s", nsrpcnodeIpaddress) + log.Printf("[WARN] citrixadc-provider: Clearing nsrpcnode state %s", nsrpcnodeIpaddress) + d.SetId("") + return nil + } + if len(dataArray) != 1 { return fmt.Errorf("[ERROR] Read multiple nsprcnode instances %v", dataArray) }