Skip to content

Commit eb85297

Browse files
committed
backport of commit 4830983
1 parent 835543b commit eb85297

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

internal/terraform/node_resource_abstract_instance.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,9 +2016,25 @@ func (n *NodeAbstractResourceInstance) apply(
20162016
}
20172017

20182018
if !configVal.IsWhollyKnown() {
2019-
diags = diags.Append(fmt.Errorf(
2020-
"configuration for %s still contains unknown values during apply (this is a bug in Terraform; please report it!)",
2021-
n.Addr,
2019+
// We don't have a pretty format function for a path, but since this is
2020+
// such a rare error, we can just drop the raw GoString values in here
2021+
// to make sure we have something to debug with.
2022+
var unknownPaths []string
2023+
cty.Transform(configVal, func(p cty.Path, v cty.Value) (cty.Value, error) {
2024+
if !v.IsKnown() {
2025+
unknownPaths = append(unknownPaths, fmt.Sprintf("%#v", p))
2026+
}
2027+
return v, nil
2028+
})
2029+
2030+
diags = diags.Append(tfdiags.Sourceless(
2031+
tfdiags.Error,
2032+
"Configuration contains unknown value",
2033+
fmt.Sprintf("configuration for %s still contains unknown values during apply (this is a bug in Terraform; please report it!)\n"+
2034+
"The following paths in the resource configuration are unknown:\n%s",
2035+
n.Addr,
2036+
strings.Join(unknownPaths, "\n"),
2037+
),
20222038
))
20232039
return nil, keyData, diags
20242040
}

0 commit comments

Comments
 (0)