-
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
Cannot set .Elem on a singly nested object block error when upgrading bridge #2185
Comments
Perhaps this is indeed legal in PF: https://developer.hashicorp.com/terraform/plugin/framework/handling-data/attributes/map-nested Not obvious where the failure is coming from then. |
I'm marking this as |
Would be curious on findings here, definitely need to tighten up testing around this. I recently updated documentation on Elem() to give it some refinement #2187 and some worked out schema examples. PF allows map-nested attributes indeed, that should project to |
One wild guess is that map-nested attributes and single-nested blocks are getting confused because they are indistinguishable in shim.Schema. |
That's very possible 😒, though I'm not sure how we would go about fixing it. The validation is at the level of |
We'd need to extend shim.Schema to contain enough information to distinguish the cases if needed. |
Did some exploration of the shim layer mapping of pf types here: #2231
These are indeed identical in the shim layer. Moreover I am fairly sure the |
The case being checked there is a PF-only concept - should this be moved out of the shim layer instead? |
This is a reversal of our previous stance that .Fields should be used. This aligns the fields argument with [schema generation](https://github.com/pulumi/pulumi-terraform-bridge/blob/72b0b7d33b6d9f0dce7c09b31951ade3711a025d/pkg/tfgen/generate.go#L395-L398). We *need* to choose `.Elem.Fields` as our 1 representation (instead of `.Fields) because of an ambiguity in `shim.Schema`. From a comment in the PR: > To prevent confusion, users are barred from specifying > information on ps directly, they must set .Fields on ps.Elem: > ps.Elem.Fields. > > We need to make this choice (instead of having users set > information on .Fields (and forbidding ps.Elem.Fields) because > the [shim.Schema] representation is not capable of > distinguishing between Map[Object] and Object. SDKv{1,2} > providers are not able to express Map[Object], but Plugin > Framework based providers are. ``` While this is technically a breaking change, I don't expect users to be broken. Any user that would break on this change would have been unable to addapt the last several bridge versions (for example: pulumiverse/pulumi-talos#99). Fixes #2185
This is a reversal of our previous stance that .Fields should be used. This aligns the fields argument with [schema generation](https://github.com/pulumi/pulumi-terraform-bridge/blob/72b0b7d33b6d9f0dce7c09b31951ade3711a025d/pkg/tfgen/generate.go#L395-L398). We *need* to choose `.Elem.Fields` as our 1 representation (instead of `.Fields`) because of an ambiguity in `shim.Schema`. From a comment in the PR: > To prevent confusion, users are barred from specifying > information on ps directly, they must set .Fields on ps.Elem: > ps.Elem.Fields. > > We need to make this choice (instead of having users set > information on .Fields (and forbidding ps.Elem.Fields) because > the [shim.Schema] representation is not capable of > distinguishing between Map[Object] and Object. SDKv{1,2} > providers are not able to express Map[Object], but Plugin > Framework based providers are. While this is technically a breaking change, I don't expect users to be broken. Any user that would break on this change would have been unable to addapt the last several bridge versions (for example: pulumiverse/pulumi-talos#99). Fixes #2185
This is a reversal of our previous stance that .Fields should be used. This aligns the fields argument with [schema generation](https://github.com/pulumi/pulumi-terraform-bridge/blob/72b0b7d33b6d9f0dce7c09b31951ade3711a025d/pkg/tfgen/generate.go#L395-L398). We *need* to choose `.Elem.Fields` as our 1 representation (instead of `.Fields`) because of an ambiguity in `shim.Schema`. From a comment in the PR: > To prevent confusion, users are barred from specifying > information on ps directly, they must set .Fields on ps.Elem: > ps.Elem.Fields. > > We need to make this choice (instead of having users set > information on .Fields (and forbidding ps.Elem.Fields) because > the [shim.Schema] representation is not capable of > distinguishing between Map[Object] and Object. SDKv{1,2} > providers are not able to express Map[Object], but Plugin > Framework based providers are. While this is technically a breaking change, I don't expect users to be broken. Any user that would break on this change would have been unable to addapt the last several bridge versions (for example: pulumiverse/pulumi-talos#99). Fixes #2185
This is a reversal of our previous stance that .Fields should be used. This aligns the fields argument with [schema generation](https://github.com/pulumi/pulumi-terraform-bridge/blob/72b0b7d33b6d9f0dce7c09b31951ade3711a025d/pkg/tfgen/generate.go#L395-L398). We *need* to choose `.Elem.Fields` as our 1 representation (instead of `.Fields`) because of an ambiguity in `shim.Schema`. From a comment in the PR: > To prevent confusion, users are barred from specifying > information on ps directly, they must set .Fields on ps.Elem: > ps.Elem.Fields. > > We need to make this choice (instead of having users set > information on .Fields (and forbidding ps.Elem.Fields) because > the [shim.Schema] representation is not capable of > distinguishing between Map[Object] and Object. SDKv{1,2} > providers are not able to express Map[Object], but Plugin > Framework based providers are. While this is technically a breaking change, I don't expect users to be broken. Any user that would break on this change would have been unable to addapt the last several bridge versions (for example: pulumiverse/pulumi-talos#99). Fixes #2185
This is a reversal of our previous stance that .Fields should be used. This aligns the fields argument with [schema generation](https://github.com/pulumi/pulumi-terraform-bridge/blob/72b0b7d33b6d9f0dce7c09b31951ade3711a025d/pkg/tfgen/generate.go#L395-L398). We *need* to choose `.Elem.Fields` as our 1 representation (instead of `.Fields`) because of an ambiguity in `shim.Schema`. From a comment in the PR: > To prevent confusion, users are barred from specifying > information on ps directly, they must set .Fields on ps.Elem: > ps.Elem.Fields. > > We need to make this choice (instead of having users set > information on .Fields (and forbidding ps.Elem.Fields) because > the [shim.Schema] representation is not capable of > distinguishing between Map[Object] and Object. SDKv{1,2} > providers are not able to express Map[Object], but Plugin > Framework based providers are. While this is technically a breaking change, I don't expect users to be broken. Any user that would break on this change would have been unable to addapt the last several bridge versions (for example: pulumiverse/pulumi-talos#99). Fixes #2185
This is a reversal of our previous stance that .Fields should be used. This aligns the fields argument with [schema generation](https://github.com/pulumi/pulumi-terraform-bridge/blob/72b0b7d33b6d9f0dce7c09b31951ade3711a025d/pkg/tfgen/generate.go#L395-L398). We *need* to choose `.Elem.Fields` as our 1 representation (instead of `.Fields`) because of an ambiguity in `shim.Schema`. From a comment in the PR: > To prevent confusion, users are barred from specifying > information on ps directly, they must set .Fields on ps.Elem: > ps.Elem.Fields. > > We need to make this choice (instead of having users set > information on .Fields (and forbidding ps.Elem.Fields) because > the [shim.Schema] representation is not capable of > distinguishing between Map[Object] and Object. SDKv{1,2} > providers are not able to express Map[Object], but Plugin > Framework based providers are. While this is technically a breaking change, I don't expect users to be broken. Any user that would break on this change would have been unable to addapt the last several bridge versions (for example: pulumiverse/pulumi-talos#99). Fixes #2185
This is a reversal of our previous stance that .Fields should be used. This aligns the fields argument with [schema generation](https://github.com/pulumi/pulumi-terraform-bridge/blob/72b0b7d33b6d9f0dce7c09b31951ade3711a025d/pkg/tfgen/generate.go#L395-L398). We *need* to choose `.Elem.Fields` as our 1 representation (instead of `.Fields`) because of an ambiguity in `shim.Schema`. From a comment in the PR: > To prevent confusion, users are barred from specifying > information on ps directly, they must set .Fields on ps.Elem: > ps.Elem.Fields. > > We need to make this choice (instead of having users set > information on .Fields (and forbidding ps.Elem.Fields) because > the [shim.Schema] representation is not capable of > distinguishing between Map[Object] and Object. SDKv{1,2} > providers are not able to express Map[Object], but Plugin > Framework based providers are. While this is technically a breaking change, I don't expect users to be broken. Any user that would break on this change would have been unable to addapt the last several bridge versions (for example: pulumiverse/pulumi-talos#99). Fixes #2185
What happened?
The talos provider started getting an error when upgrading the bridge: https://github.com/pulumiverse/pulumi-talos/actions/runs/9934039926/job/27437766510
The error comes from here:
pulumi-terraform-bridge/pkg/tfbridge/info/validate.go
Line 121 in 0e639f6
@ringods tried to fix it by removing the .Elem nesting and the types overrides no longer work: https://github.com/pulumiverse/pulumi-talos/pull/99/files#diff-34c57e622183cb0d8dd0d3f9eaa0861b3340120e9b2ad811bac7ac7be4cea4b1
I believe there is something wrong with the code above as it checks for Map nested Resource Elems which is illegal in sdkv2.
Example
.
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: