Skip to content

Commit 1d6b032

Browse files
implement detailed diff for pf
1 parent 1a64937 commit 1d6b032

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

pkg/pf/tfbridge/provider_diff.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,39 @@ func (p *provider) DiffWithContext(
122122
changes = plugin.DiffSome
123123
}
124124

125+
var pluginDetailedDiff map[string]plugin.PropertyDiff
126+
{
127+
priorProps, err := convert.DecodePropertyMap(ctx, rh.decoder, priorState.state.Value)
128+
if err != nil {
129+
return plugin.DiffResult{}, err
130+
}
131+
132+
props, err := convert.DecodePropertyMap(ctx, rh.decoder, plannedStateValue)
133+
if err != nil {
134+
return plugin.DiffResult{}, err
135+
}
136+
137+
detailedDiff := tfbridge.MakeDetailedDiffV2(
138+
ctx,
139+
rh.schemaOnlyShimResource.Schema(),
140+
rh.pulumiResourceInfo.GetFields(),
141+
priorProps,
142+
props,
143+
checkedInputs,
144+
)
145+
146+
pluginDetailedDiff = make(map[string]plugin.PropertyDiff, len(detailedDiff))
147+
for k, v := range detailedDiff {
148+
pluginDetailedDiff[k] = plugin.PropertyDiff{Kind: plugin.DiffKind(v.Kind), InputDiff: v.InputDiff}
149+
}
150+
}
151+
125152
diffResult := plugin.DiffResult{
126153
Changes: changes,
127154
ReplaceKeys: replaceKeys,
128155
ChangedKeys: changedKeys,
129156
DeleteBeforeReplace: deleteBeforeReplace,
157+
DetailedDiff: pluginDetailedDiff,
130158
}
131159

132160
// TODO[pulumi/pulumi-terraform-bridge#824] StableKeys

0 commit comments

Comments
 (0)