From 2914a38202c21ac63948b58a998c0726278d3c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Tue, 31 Jan 2017 10:58:16 +0100 Subject: [PATCH] Recreate Rancher stack if it was removed (#11539) --- builtin/providers/rancher/resource_rancher_stack.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builtin/providers/rancher/resource_rancher_stack.go b/builtin/providers/rancher/resource_rancher_stack.go index 8bff744b88a3..ccdb4c059d83 100644 --- a/builtin/providers/rancher/resource_rancher_stack.go +++ b/builtin/providers/rancher/resource_rancher_stack.go @@ -132,6 +132,12 @@ func resourceRancherStackRead(d *schema.ResourceData, meta interface{}) error { return err } + if stack.State == "removed" { + log.Printf("[INFO] Stack %s was removed on %v", d.Id(), stack.Removed) + d.SetId("") + return nil + } + config, err := client.Environment.ActionExportconfig(stack, &rancherClient.ComposeConfigInput{}) if err != nil { return err