-
Notifications
You must be signed in to change notification settings - Fork 50
Description
What happened?
A user reports hitting this in cloudflare: pulumi/pulumi-cloudflare#1197 (comment)
The problem is here which is a miss:
| return nil, fmt.Errorf("DynamicPseudoType is not yet supported") |
In particular this #2362 feature was incomplete and missed an update test.
Researching a possible fix a bit, we might want to extend valueshim to handle dynamic types and remove the package that currently contains the error to reduce duplication.
The question becomes how should the dynamic types be represented in RawState.
What we are trying to do is build a tfprotov6.RawState to send to a providers' UpgradeResourceState method. terraform-plugin-go has the inverse logic (parsing this JSON form) but not serializing it:
https://github.com/hashicorp/terraform-plugin-go/blob/v0.26.0/tfprotov6/state.go#L45
https://github.com/hashicorp/terraform-plugin-go/blob/v0.26.0/tftypes/value_json.go#L21
https://github.com/hashicorp/terraform-plugin-go/blob/v0.26.0/tftypes/value_json.go#L194
This is interesting how this data is processed:
https://github.com/opentofu/opentofu/blob/4083fe2cc4a483fc19d9769e0eb19ebee2386b33/internal/tofu/upgrade_resource_state.go#L28
https://github.com/opentofu/opentofu/blob/4083fe2cc4a483fc19d9769e0eb19ebee2386b33/internal/states/instance_object_src.go#L42
https://github.com/opentofu/opentofu/blob/4083fe2cc4a483fc19d9769e0eb19ebee2386b33/internal/states/instance_object_src.go#L89
https://github.com/opentofu/opentofu/blob/4083fe2cc4a483fc19d9769e0eb19ebee2386b33/internal/states/instance_object.go#L113
I think ctyjson.Umarshal() and ctyjson.Marshal cover the correct form.
Both seem to point out that the serialized form for DynamicPseudoType is {"type": ..., "value": "..."} in Raw JSON, that is the concrete type of the value is written out into this form.
We should probably do this, confirm in a test that's what providers receive under TF, and complete the end-to-end tests with a test that covers Updates or somehow triggers the code.
Example
See the cloudflare link.
Output of pulumi about
N/A
Additional context
N/A
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).