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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge converts missing sets wrong when passing to TF provider #1970

Closed
VenelinMartinov opened this issue May 14, 2024 · 2 comments · Fixed by #1971
Closed

Bridge converts missing sets wrong when passing to TF provider #1970

VenelinMartinov opened this issue May 14, 2024 · 2 comments · Fixed by #1971
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@VenelinMartinov
Copy link
Contributor

What happened?

Similar to #1916 and #1915, empty sets are also represented wrong in pulumi.

We output a cty.NullVal instead of a cty.SetValEmpty

Example

TestOptionalSetNotSpecified

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).

@VenelinMartinov VenelinMartinov added the kind/bug Some behavior is incorrect or out of spec label May 14, 2024
@VenelinMartinov VenelinMartinov changed the title makeTerraformInputs converts empty sets wrong makeTerraformInputs converts missing sets wrong May 14, 2024
@t0yv0
Copy link
Member

t0yv0 commented May 16, 2024

Curious if we can fix this. There are some good changes blocked on this now, including #1976

@VenelinMartinov
Copy link
Contributor Author

Yup, actively working on this in #1971

@VenelinMartinov VenelinMartinov changed the title makeTerraformInputs converts missing sets wrong Pulumi converts missing sets wrong when passing to TF provider May 28, 2024
@VenelinMartinov VenelinMartinov changed the title Pulumi converts missing sets wrong when passing to TF provider Bridge converts missing sets wrong when passing to TF provider May 28, 2024
VenelinMartinov added a commit that referenced this issue Jun 5, 2024
part of #1785

This change adds a normalisation step for collections when recovering
cty values to pass to terraform. This ensures we represent them
similarly to terraform.

In practice this means that all block collections need to be passed to
TF providers as an empty collection instead of nil. This should get rid
of quite a few subtle discrepancies in the data we pass to the TF
provider code. These sometimes result in panics since we pass unexpected
nils.

This gets rid of all known input discrepancies discovered so far through
cross-testing.

The full rules for what is a block are
[here](https://github.com/hashicorp/terraform-plugin-sdk/blob/1f499688ebd9420768f501d4ed622a51b2135ced/helper/schema/core_schema.go#L60).
It is essentially properties with schema: typeList or typeSet with a
Resource Elem.

fixes #1970
fixes #1915
fixes #1964
fixes #1767 
fixes #1762 

TODO: [DONE] remove the MaxItemsOne default hacks introduced in
#1725 (opened
#2049)

---------

Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
Co-authored-by: Ian Wahbe <ian@wahbe.com>
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants