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.
This commit is contained in:
James Bardin 2017-02-24 09:26:14 -05:00
parent fbc11c7961
commit 2a73331c62
1 changed files with 3 additions and 3 deletions

View File

@ -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),