From 2fdf984cce1199f0f39870ef78e7f2e5c69d2a9c Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 6 Dec 2019 09:45:19 -0500 Subject: [PATCH 1/2] update destroy provisioner warning text Make it a little more user-oriented --- configs/provisioner.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configs/provisioner.go b/configs/provisioner.go index fc5136ddd..bbc6de993 100644 --- a/configs/provisioner.go +++ b/configs/provisioner.go @@ -149,8 +149,11 @@ func onlySelfRefs(body hcl.Body) hcl.Diagnostics { diags = append(diags, &hcl.Diagnostic{ Severity: hcl.DiagWarning, Summary: "External references from destroy provisioners are deprecated", - Detail: "Destroy time provisioners and their connections may only reference values stored in the instance state, which include 'self', 'count.index', or 'each.key'.", - Subject: attr.Expr.Range().Ptr(), + Detail: "Destroy-time provisioners and their connection configurations may only " + + "reference attributes of the related resource, via 'self', 'count.index', " + + "or 'each.key'.\n\nReferences to other resources during the destroy phase " + + "can cause dependency cycles and interact poorly with create_before_destroy.", + Subject: attr.Expr.Range().Ptr(), }) } } From b715ef2590fe0ad2fda2622f67f52a9c13231e7b Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 6 Dec 2019 09:46:03 -0500 Subject: [PATCH 2/2] don't print just warnings when loading backend cfg Any warnings will be caught again when the entire config is loaded, and duplicated in the output. --- command/meta_config.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/command/meta_config.go b/command/meta_config.go index ec7b3ec16..2bb104a11 100644 --- a/command/meta_config.go +++ b/command/meta_config.go @@ -173,10 +173,13 @@ func (m *Meta) dirIsConfigPath(dir string) bool { // directory even if loadBackendConfig succeeded.) func (m *Meta) loadBackendConfig(rootDir string) (*configs.Backend, tfdiags.Diagnostics) { mod, diags := m.loadSingleModule(rootDir) + + // Only return error diagnostics at this point. Any warnings will be caught + // again later and duplicated in the output. if diags.HasErrors() { return nil, diags } - return mod.Backend, diags + return mod.Backend, nil } // loadValuesFile loads a file that defines a single map of key/value pairs.