From 868bb0148e1cb8785ad55c9579fe8fe4d17980f8 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 7 Jul 2021 10:31:40 +0530 Subject: [PATCH] added failure check and tainting on failure --- ibm/resource_ibm_is_instance.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ibm/resource_ibm_is_instance.go b/ibm/resource_ibm_is_instance.go index 67bef87280..8a8faaf451 100644 --- a/ibm/resource_ibm_is_instance.go +++ b/ibm/resource_ibm_is_instance.go @@ -996,6 +996,7 @@ func isWaitForInstanceAvailable(instanceC *vpcv1.VpcV1, id string, timeout time. forceTimeout := v.(int) go isRestartStartAction(instanceC, id, d, forceTimeout, communicator) } + return stateConf.WaitForState() } @@ -1040,6 +1041,10 @@ func isInstanceRefreshFunc(instanceC *vpcv1.VpcV1, id string, d *schema.Resource if *instance.Status == "available" || *instance.Status == "failed" || *instance.Status == "running" { // let know the isRestartStartAction() to stop close(communicator) + // taint the instance if status is failed + if *instance.Status == "failed" { + return instance, *instance.Status, fmt.Errorf("Instance (%s) went into failed state during the operation \n [WARNING] Running terraform apply again will remove the tainted instance and attempt to create the instance again replacing the previous configuration", *instance.ID) + } return instance, *instance.Status, nil }