-
Notifications
You must be signed in to change notification settings - Fork 34
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
Dynamic Pseudo Types inside of Blocks with nested mode of list cant be unmarshalled to tfvalues #267
Labels
bug
Something isn't working
Comments
Nciso
changed the title
Dynamic Pseudo Types inside of Blocks with nested mode of list cant be unmarshalled to tftyvalues
Dynamic Pseudo Types inside of Blocks with nested mode of list cant be unmarshalled to tfvalues
Feb 28, 2023
Hi, encountering a similar issue and wondering if there were any updates here? Thanks! |
There seems to be a similar issue with using {
Name: "config_patches",
Type: tftypes.List{
ElementType: tftypes.DynamicPseudoType,
},
Optional: true,
}, this returns an error way earlier in plan │ Inappropriate value for attribute "config_patches": all list elements must have the same
│ type.
when using |
frezbo
added a commit
to siderolabs/terraform-provider-talos
that referenced
this issue
Apr 4, 2023
Example usage of TF mux and plugin go. There seems to be some limitations around using `DynamicPseudoType` with lists and the TF docs generation tool lack support for tuples. So for now it's better to stick to plugin framework only. Ref: hashicorp/terraform-plugin-go#267 Signed-off-by: Noel Georgi <git@frezbo.dev>
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
terraform-plugin-go version
Relevant provider source code
E2E test https://github.com/Nciso/low_level_provider_example/blob/main/internal/data_dummy/dummy_data_test.go#L17
Terraform Configuration Files
Expected Behavior
it should be able to create a statefile, this behavior is happening if your remove the DPT of the
dynamic_block
schema and change it to a string, (tftypes.String
instead oftftypes.DynamicPseudoType
)Actual Behavior
A panic is produced
Steps to Reproduce
Run the following test
https://github.com/Nciso/low_level_provider_example/blob/main/internal/data_dummy/dummy_data_test.go#L17
References
Inspecting with the debugger I found the following:
Changing the nesting mode in the block attributes changes the behavior of the types
fail decoding,
testName: decoded_with_dpt_block error -> AttributeName("dynamic_block"): error decoding object length: msgpack: invalid code=92 decoding map length
When the terraform core code is reached, there is a conversion from the schema to a cty.Value, if a block contains a DPT it will change the whole root attribute of the block to a DTP instead of changing the local attribute, https://github.com/hashicorp/terraform-plugin-sdk/blob/main/internal/configs/configschema/implied_type.go#L40
Also this is the code that is not allowing DPT in sets, https://github.com/hashicorp/terraform-plugin-sdk/blob/main/internal/configs/configschema/implied_type.go#L47
Once the cty value reaches to
objchange
in theterraform plan
time, it panics because the cty.object was transformed to a cty.dynamicPseudoType in the above step https://github.com/hashicorp/terraform/blob/main/internal/plans/objchange/objchange.go#L71The text was updated successfully, but these errors were encountered: