fix each and count usage in import for sensitive values (#1530)

Signed-off-by: ollevche <ollevche@gmail.com>
This commit is contained in:
Oleksandr Levchenkov 2024-04-22 23:12:03 +03:00 committed by GitHub
parent 846fd267fd
commit f36def0a45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -560,7 +560,21 @@ func (n *NodePlannableResourceInstance) importState(ctx EvalContext, addr addrs.
// Insert marks from configuration
if n.Config != nil {
valueWithConfigurationSchemaMarks, _, configDiags := ctx.EvaluateBlock(n.Config.Config, n.Schema, nil, EvalDataForNoInstanceKey)
keyData := EvalDataForNoInstanceKey
switch {
case n.Config.Count != nil:
keyData = InstanceKeyEvalData{
CountIndex: cty.UnknownVal(cty.Number),
}
case n.Config.ForEach != nil:
keyData = InstanceKeyEvalData{
EachKey: cty.UnknownVal(cty.String),
EachValue: cty.UnknownVal(cty.DynamicPseudoType),
}
}
valueWithConfigurationSchemaMarks, _, configDiags := ctx.EvaluateBlock(n.Config.Config, n.Schema, nil, keyData)
diags = diags.Append(configDiags)
if configDiags.HasErrors() {
return instanceRefreshState, diags