From e54e90dcd388633f283c1868b798b109155d4013 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