@@ -29,7 +29,6 @@ import (
2929 "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
3030
3131 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/convert"
32- "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/internal/pfutils"
3332 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/reservedkeys"
3433 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
3534 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/valueshim"
@@ -257,6 +256,7 @@ func (p *provider) parseAndUpgradeResourceState(
257256 return nil , fmt .Errorf ("[pf/tfbridge] Error calling EncodePropertyMap: %w" , err )
258257 }
259258
259+
260260 // Before EnableRawStateDelta rollout, the behavior used to be to skip the upgrade method in case of an exact
261261 // version match. This seems incorrect, but to derisk fixing this problem it is flagged together with
262262 // EnableRawStateDelta so it participates in the phased rollout. Remove once rollout completes.
@@ -269,10 +269,11 @@ func (p *provider) parseAndUpgradeResourceState(
269269 }
270270
271271 tfType := rh .schema .Type (ctx ).(tftypes.Object )
272- rawState , err := pfutils . NewRawState ( tfType , value )
272+ rawStateBytes , err := valueshim . FromTValue ( value ). Marshal ( valueshim . FromTType ( tfType ) )
273273 if err != nil {
274274 return nil , fmt .Errorf ("[pf/tfbridge] Error calling NewRawState: %w" , err )
275275 }
276+ rawState := & tfprotov6.RawState {JSON : []byte (rawStateBytes )}
276277
277278 return p .upgradeResourceState (ctx , rh , rawState , parsedMeta .PrivateState , stateVersion )
278279}
0 commit comments