Skip to content

Commit

Permalink
implement detailed diff for pf
Browse files Browse the repository at this point in the history
  • Loading branch information
VenelinMartinov committed Nov 18, 2024
1 parent f2bec29 commit 50fdce9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkg/pf/tfbridge/provider_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,39 @@ func (p *provider) DiffWithContext(
changes = plugin.DiffSome
}

var pluginDetailedDiff map[string]plugin.PropertyDiff
{
priorProps, err := convert.DecodePropertyMap(ctx, rh.decoder, priorState.state.Value)
if err != nil {
return plugin.DiffResult{}, err
}

props, err := convert.DecodePropertyMap(ctx, rh.decoder, plannedStateValue)
if err != nil {
return plugin.DiffResult{}, err
}

detailedDiff := tfbridge.MakeDetailedDiffV2(
ctx,
rh.schemaOnlyShimResource.Schema(),
rh.pulumiResourceInfo.GetFields(),
priorProps,
props,
checkedInputs,
)

pluginDetailedDiff = make(map[string]plugin.PropertyDiff, len(detailedDiff))
for k, v := range detailedDiff {
pluginDetailedDiff[k] = plugin.PropertyDiff{Kind: plugin.DiffKind(v.Kind), InputDiff: v.InputDiff}
}
}

diffResult := plugin.DiffResult{
Changes: changes,
ReplaceKeys: replaceKeys,
ChangedKeys: changedKeys,
DeleteBeforeReplace: deleteBeforeReplace,
DetailedDiff: pluginDetailedDiff,
}

// TODO[pulumi/pulumi-terraform-bridge#824] StableKeys
Expand Down

0 comments on commit 50fdce9

Please sign in to comment.