-
Notifications
You must be signed in to change notification settings - Fork 50
Description
The task is to build an algo that compares prior and planned state at Pulumi level.
Resolves #1895
Resolves #186
Resolves #1504
func makePulumiDetailedDiff(
ctx context.Context,
tfs shim.SchemaMap,
ps map[string]*SchemaInfo,
oldState, plannedState resource.PropertyMap,
) (map[string]*pulumirpc.PropertyDiff) {This is intended to replace the current signature that tries to do inference on the shim.InstanceDiff object that wraps the terraform.InstanceDiff object:
func makeDetailedDiff(
ctx context.Context,
tfs shim.SchemaMap,
ps map[string]*SchemaInfo,
olds, news resource.PropertyMap,
tfDiff shim.InstanceDiff,
) (map[string]*pulumirpc.PropertyDiff, pulumirpc.DiffResponse_DiffChanges) {As TF CLI does not access terraform.InstanceDiff but renders diffs by comparing existing and planned state, this would make bridged providers behave more in line with TF expected behavior.
The schema-aware requirement comes down to keep tracking schema (SchemaInfo/SchemaMap) or else current paths through the transformation. When diffing collections, the algo needs to be able to tell when the two diffed PropertyValue arrays are representing a TF set under the hood. PropertyPathToSchemaPath and LookupSchemas can be helpful here.
#2200 outlines a suggestion for how set collection diffs should be handled. The cases where plannedState has unknowns with sets are a bit under-specified, suggest treating the entire new set as an unknown in that case old => UNKNOWN.
This change should be flagged together with all the other work in the epic for a consistent rollout.