@@ -122,31 +122,9 @@ func (p *provider) DiffWithContext(
122
122
changes = plugin .DiffSome
123
123
}
124
124
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
- }
125
+ pluginDetailedDiff , err := calculateDetailedDiff (ctx , & rh , priorState , plannedStateValue , checkedInputs )
126
+ if err != nil {
127
+ return plugin.DiffResult {}, err
150
128
}
151
129
152
130
diffResult := plugin.DiffResult {
@@ -161,6 +139,37 @@ func (p *provider) DiffWithContext(
161
139
return diffResult , nil
162
140
}
163
141
142
+ func calculateDetailedDiff (
143
+ ctx context.Context , rh * resourceHandle , priorState * upgradedResourceState ,
144
+ plannedStateValue tftypes.Value , checkedInputs resource.PropertyMap ,
145
+ ) (map [string ]plugin.PropertyDiff , error ) {
146
+ priorProps , err := convert .DecodePropertyMap (ctx , rh .decoder , priorState .state .Value )
147
+ if err != nil {
148
+ return nil , err
149
+ }
150
+
151
+ props , err := convert .DecodePropertyMap (ctx , rh .decoder , plannedStateValue )
152
+ if err != nil {
153
+ return nil , err
154
+ }
155
+
156
+ detailedDiff := tfbridge .MakeDetailedDiffV2 (
157
+ ctx ,
158
+ rh .schemaOnlyShimResource .Schema (),
159
+ rh .pulumiResourceInfo .GetFields (),
160
+ priorProps ,
161
+ props ,
162
+ checkedInputs ,
163
+ )
164
+
165
+ pluginDetailedDiff := make (map [string ]plugin.PropertyDiff , len (detailedDiff ))
166
+ for k , v := range detailedDiff {
167
+ pluginDetailedDiff [k ] = plugin.PropertyDiff {Kind : plugin .DiffKind (v .Kind ), InputDiff : v .InputDiff }
168
+ }
169
+
170
+ return pluginDetailedDiff , nil
171
+ }
172
+
164
173
// For each path x.y.z extracts the next step x and converts it to a matching Pulumi key. Removes
165
174
// duplicates and orders the result.
166
175
func topLevelPropertyKeySet (
0 commit comments