Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consume OldInputs when diffing in infer #218

Open
iwahbe opened this issue Apr 13, 2024 · 0 comments
Open

Consume OldInputs when diffing in infer #218

iwahbe opened this issue Apr 13, 2024 · 0 comments
Labels
kind/enhancement Improvements or new features

Comments

@iwahbe
Copy link
Member

iwahbe commented Apr 13, 2024

Hello!

  • Vote on this issue by adding a 馃憤 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

infer currently assumes that old inputs will be included in resource outputs when diffing. At the time, that was the best it could do but we now have access to the OldInputs field on gRPC. We should use that when available.

Affected area/feature

inputProps, err := introspect.FindProperties(new(I))
if err != nil {
return p.DiffResponse{}, err
}
// Olds is an Output, but news is an Input. Output should be a superset of Input,
// so we need to filter out fields that are in Output but not Input.
oldInputs := resource.PropertyMap{}
for k := range inputProps {
key := resource.PropertyKey(k)
oldInputs[key] = req.Olds[key]
}
objDiff := oldInputs.Diff(req.News)
pluginDiff := plugin.NewDetailedDiffFromObjectDiff(objDiff, false)
diff := map[string]p.PropertyDiff{}

@iwahbe iwahbe added the kind/enhancement Improvements or new features label Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

1 participant