From 0fb87e499dc3712c072524a6ea148369288c5877 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sat, 11 Oct 2014 18:34:11 -0700 Subject: [PATCH] command: Meta provides the state output path --- command/apply.go | 2 +- command/meta.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/command/apply.go b/command/apply.go index 80b48e926..e7f92bbdf 100644 --- a/command/apply.go +++ b/command/apply.go @@ -215,7 +215,7 @@ func (c *ApplyCommand) Run(args []string) int { "infrastructure, so keep it safe. To inspect the complete state\n"+ "use the `terraform show` command.\n\n"+ "State path: %s", - c.Meta.stateOutPath))) + c.Meta.StateOutPath()))) } // If we have outputs, then output those at the end. diff --git a/command/meta.go b/command/meta.go index f1a3b8e6f..768a999e5 100644 --- a/command/meta.go +++ b/command/meta.go @@ -76,6 +76,16 @@ func (m *Meta) initStatePaths() { } } +// StateOutPath returns the true output path for the state file +func (m *Meta) StateOutPath() string { + m.initStatePaths() + if m.useRemoteState { + path, _ := remote.HiddenStatePath() + return path + } + return m.stateOutPath +} + // Colorize returns the colorization structure for a command. func (m *Meta) Colorize() *colorstring.Colorize { return &colorstring.Colorize{