Merge pull request #23595 from hashicorp/jbardin/deprecate-destroy-references
Update destroy provisioner warnings
This commit is contained in:
commit
f281eb2b44
|
@ -173,10 +173,13 @@ func (m *Meta) dirIsConfigPath(dir string) bool {
|
||||||
// directory even if loadBackendConfig succeeded.)
|
// directory even if loadBackendConfig succeeded.)
|
||||||
func (m *Meta) loadBackendConfig(rootDir string) (*configs.Backend, tfdiags.Diagnostics) {
|
func (m *Meta) loadBackendConfig(rootDir string) (*configs.Backend, tfdiags.Diagnostics) {
|
||||||
mod, diags := m.loadSingleModule(rootDir)
|
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() {
|
if diags.HasErrors() {
|
||||||
return nil, diags
|
return nil, diags
|
||||||
}
|
}
|
||||||
return mod.Backend, diags
|
return mod.Backend, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// loadValuesFile loads a file that defines a single map of key/value pairs.
|
// loadValuesFile loads a file that defines a single map of key/value pairs.
|
||||||
|
|
|
@ -149,7 +149,10 @@ func onlySelfRefs(body hcl.Body) hcl.Diagnostics {
|
||||||
diags = append(diags, &hcl.Diagnostic{
|
diags = append(diags, &hcl.Diagnostic{
|
||||||
Severity: hcl.DiagWarning,
|
Severity: hcl.DiagWarning,
|
||||||
Summary: "External references from destroy provisioners are deprecated",
|
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'.",
|
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(),
|
Subject: attr.Expr.Range().Ptr(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue