From 6c801d03864977c3f17123922cc7b2a0f3ebbaf4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 2 Nov 2016 22:33:34 -0700 Subject: [PATCH] command/apply: add additional nil check to loading state for outputs --- command/apply.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/command/apply.go b/command/apply.go index 1f353593a..57779143e 100644 --- a/command/apply.go +++ b/command/apply.go @@ -430,7 +430,12 @@ func outputsAsString(state *terraform.State, modPath []string, schema []*config. return "" } - outputs := state.ModuleByPath(modPath).Outputs + ms := state.ModuleByPath(modPath) + if ms == nil { + return "" + } + + outputs := ms.Outputs outputBuf := new(bytes.Buffer) if len(outputs) > 0 { schemaMap := make(map[string]*config.Output)