From 2a73331c6247f8e42d16901fa14fab1408fbe13e Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 24 Feb 2017 09:26:14 -0500 Subject: [PATCH] use State.HasResources rather than State.Empty Destroying a terraform state can't always create an empty state, as outputs and the root module may remain. Use HasResources to warn about deleting an environment with resources. --- command/env_delete.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/command/env_delete.go b/command/env_delete.go index 95b734d44..b573e57d5 100644 --- a/command/env_delete.go +++ b/command/env_delete.go @@ -99,9 +99,9 @@ func (c *EnvDeleteCommand) Run(args []string) int { return 1 } - empty := sMgr.State().Empty() + hasResources := sMgr.State().HasResources() - if !empty && !force { + if hasResources && !force { c.Ui.Error(fmt.Sprintf(envNotEmpty, delEnv)) return 1 } @@ -128,7 +128,7 @@ func (c *EnvDeleteCommand) Run(args []string) int { ), ) - if !empty { + if hasResources { c.Ui.Output( c.Colorize().Color( fmt.Sprintf(envWarnNotEmpty, delEnv),