-
Notifications
You must be signed in to change notification settings - Fork 44
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use TF Diff Attributes to set diff response changes when SkipDetailedDiffForChanges feature flag is set #1502
Changes from all commits
4e8190d
18ac83f
840d8dd
3aa4ce5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -661,6 +661,17 @@ func (p *Provider) Diff(ctx context.Context, req *pulumirpc.DiffRequest) (*pulum | |
doIgnoreChanges(ctx, res.TF.Schema(), res.Schema.Fields, olds, news, req.GetIgnoreChanges(), diff) | ||
detailedDiff, changes := makeDetailedDiff(ctx, res.TF.Schema(), res.Schema.Fields, olds, news, diff) | ||
|
||
// There are some providers/situations which `makeDetailedDiff` distorts the expected changes, leading | ||
// to changes being dropped by Pulumi. | ||
// Until we fix `makeDetailedDiff`, it is safer to refer to the Terraform Diff attribute length for setting | ||
// the DiffResponse. | ||
// We will still use `detailedDiff` for diff display purposes. | ||
|
||
// See also https://github.com/pulumi/pulumi-terraform-bridge/issues/1501. | ||
if p.info.XSkipDetailedDiffForChanges && len(diff.Attributes()) > 0 { | ||
changes = pulumirpc.DiffResponse_DIFF_SOME | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noting that it doesn't do the inverse, that is if len(diff.Attributes()) == 0 but makeDetailedDiff returned CHANGES, it does not override it back to NO_CHANGES. Is that perhaps a degenerate/ non-existent situation? Reading the code seems to be the case, so we're probably fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have not verified such a situation as of today to the best of my knowledge. |
||
} | ||
|
||
// If there were changes in this diff, check to see if we have a replacement. | ||
var replaces []string | ||
var replaced map[string]bool | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could probably delete a lot here the test will only exercise CustomizeDiff