mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-20 11:48:24 -06:00
commit
dc154cf242
@ -127,6 +127,16 @@ func ResourceChange(
|
||||
panic(fmt.Sprintf("failed to decode plan for %s while rendering diff: %s", addr, err))
|
||||
}
|
||||
|
||||
// We currently have an opt-out that permits the legacy SDK to return values
|
||||
// that defy our usual conventions around handling of nesting blocks. To
|
||||
// avoid the rendering code from needing to handle all of these, we'll
|
||||
// normalize first.
|
||||
// (Ideally we'd do this as part of the SDK opt-out implementation in core,
|
||||
// but we've added it here for now to reduce risk of unexpected impacts
|
||||
// on other code in core.)
|
||||
changeV.Change.Before = objchange.NormalizeObjectFromLegacySDK(changeV.Change.Before, schema)
|
||||
changeV.Change.After = objchange.NormalizeObjectFromLegacySDK(changeV.Change.After, schema)
|
||||
|
||||
bodyWritten := p.writeBlockBodyDiff(schema, changeV.Before, changeV.After, 6, path)
|
||||
if bodyWritten {
|
||||
buf.WriteString("\n")
|
||||
|
@ -9,8 +9,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/terraform/plans/objchange"
|
||||
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
ctyconvert "github.com/zclconf/go-cty/cty/convert"
|
||||
"github.com/zclconf/go-cty/cty/msgpack"
|
||||
@ -460,7 +458,6 @@ func (s *GRPCProviderServer) ReadResource(_ context.Context, req *proto.ReadReso
|
||||
}
|
||||
|
||||
newStateVal = copyTimeoutValues(newStateVal, stateVal)
|
||||
newStateVal = objchange.NormalizeObjectFromLegacySDK(newStateVal, block)
|
||||
|
||||
newStateMP, err := msgpack.Marshal(newStateVal, block.ImpliedType())
|
||||
if err != nil {
|
||||
@ -597,7 +594,6 @@ func (s *GRPCProviderServer) PlanResourceChange(_ context.Context, req *proto.Pl
|
||||
}
|
||||
|
||||
plannedStateVal = copyTimeoutValues(plannedStateVal, proposedNewStateVal)
|
||||
plannedStateVal = objchange.NormalizeObjectFromLegacySDK(plannedStateVal, block)
|
||||
|
||||
// The old SDK code has some imprecisions that cause it to sometimes
|
||||
// generate differences that the SDK itself does not consider significant
|
||||
@ -836,7 +832,6 @@ func (s *GRPCProviderServer) ApplyResourceChange(_ context.Context, req *proto.A
|
||||
newStateVal = normalizeNullValues(newStateVal, plannedStateVal, false)
|
||||
|
||||
newStateVal = copyTimeoutValues(newStateVal, plannedStateVal)
|
||||
newStateVal = objchange.NormalizeObjectFromLegacySDK(newStateVal, block)
|
||||
|
||||
newStateMP, err := msgpack.Marshal(newStateVal, block.ImpliedType())
|
||||
if err != nil {
|
||||
@ -960,7 +955,6 @@ func (s *GRPCProviderServer) ReadDataSource(_ context.Context, req *proto.ReadDa
|
||||
}
|
||||
|
||||
newStateVal = copyTimeoutValues(newStateVal, configVal)
|
||||
newStateVal = objchange.NormalizeObjectFromLegacySDK(newStateVal, block)
|
||||
|
||||
newStateMP, err := msgpack.Marshal(newStateVal, block.ImpliedType())
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user