-
Notifications
You must be signed in to change notification settings - Fork 43
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
PF wrong diff for set of objects #2170
Comments
Removing the "vlan_names": schema.SetNestedAttribute{
MarkdownDescription: `An array of named VLANs`,
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
MarkdownDescription: `Name of the VLAN, string length must be from 1 to 32 characters`,
// Computed: true,
Optional: true,
},
"vlan_id": schema.StringAttribute{
MarkdownDescription: `VLAN ID`,
Computed: true,
Optional: true,
},
},
},
}, |
We seem to get the wrong value from the TF plan in
However this does seem to repro in TF, so they are likely doing something different with the plan parameters. |
Possibly related: #703 - this specifically calls out nested Optional + Computed as a likely issue |
We recently updated our ProposedNew copy in SDKV2: #2060 Could be that the PF re-implementation is based on the old TF version |
Seems like we didn't re-use that as it works off the cty types instead of the pf tftypes and instead opted to re-implement it on our side. |
Some relevant-looking changes upstream, maybe related: opentofu/opentofu@d49e991 a few others too https://github.com/opentofu/opentofu/commits/main/internal/plans/objchange We have not picked up any of these fixes - I wonder if re-using the upstream code and adding a translation layer will be better here - it'd make picking up usptream fixes much easier like we do in SDKV2 |
Verified the issue indeed happens during the joining of the prior state and new config here:
Join incorrectly returns the old state of the set with a single element for the test above. |
Think I might have found the culprit: pulumi-terraform-bridge/pf/internal/pfutils/proposed_new.go Lines 64 to 67 in 18db7c5
We have an override for Set equality which replaces all Computed attributes with nulls - this prob means that if a set contains only entirely computed elements, they'd get wrongly equated. Indeed commenting out that line seems to resolve the issue - now on to find why it is there in the first place. |
There's a chance it might be addressed by #2188 but will need to confirm explicitly |
I don't think #2188 addresses this - the reason this is happening is #2170 (comment) We consider elements with all properties computed (+optional) equal, no matter their values. |
Can you elaborate? 2188 literally deletes the code you reference in that comment. |
Okay, fair, didn't realise that - good chance it fixes it then! |
What happened?
During pulumi/pulumi-meraki#97 it was discovered that the pf bridge does not produce a diff when an element is added to set of objects.
Seems like this happens only if all of the properties of the object are Computed + Optional
Example
#2168
Output of
pulumi about
.
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: