Skip to content

Commit 1d39793

Browse files
t0yv0VenelinMartinov
authored andcommitted
Replace pfutils
1 parent 0c4501f commit 1d39793

File tree

3 files changed

+3
-219
lines changed

3 files changed

+3
-219
lines changed

pkg/pf/internal/pfutils/raw_state.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

pkg/pf/internal/pfutils/value_to_json.go

Lines changed: 0 additions & 189 deletions
This file was deleted.

pkg/pf/tfbridge/resource_state.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)