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

MsgPack doesn't handle DynamicPseudoType in complex types correctly #95

Closed
paddycarver opened this issue Aug 9, 2021 · 1 comment · Fixed by #100
Closed

MsgPack doesn't handle DynamicPseudoType in complex types correctly #95

paddycarver opened this issue Aug 9, 2021 · 1 comment · Fixed by #100
Assignees
Labels
bug Something isn't working
Milestone

Comments

@paddycarver
Copy link
Contributor

terraform-plugin-go version

v0.3.1

Expected Behavior

Complex types that have DynamicPseudoType elements or attributes (a map of DynamicPseudoTypes, an object with a DynamicPseudoType attribute, etc.) should be surfaced as a value with concrete, known types when unmarshaled from msgpack.

Actual Behavior

The values retain their type constraints as types, instead of the actual type. Meaning they'd still have DynamicPseudoType as their type, instead of their concrete type.

References

@paddycarver paddycarver added the bug Something isn't working label Aug 9, 2021
@bflad bflad self-assigned this Aug 10, 2021
@bflad bflad added this to the v0.4.0 milestone Aug 10, 2021
bflad added a commit that referenced this issue Aug 11, 2021
…ing DynamicPseudoType as their type when unmarshaling msgpack values from Terraform.

Reference: #95

Previously:

```
--- FAIL: TestValueFromMsgPack (0.00s)
    --- FAIL: TestValueFromMsgPack/object-dynamic (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-go/tftypes/value_msgpack_test.go:501: Unexpected results (-wanted +got):   tftypes.Value(
            - 	s`tftypes.Object["greeting":tftypes.String]<"greeting":tftypes.String<"hello">>`,
            + 	s`tftypes.Object["greeting":tftypes.DynamicPseudoType]<"greeting":tftypes.String<"hello">>`,
              )
    --- FAIL: TestValueFromMsgPack/map-dynamic (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-go/tftypes/value_msgpack_test.go:501: Unexpected results (-wanted +got):   tftypes.Value(
            - 	s`tftypes.Map[tftypes.String]<"greeting":tftypes.String<"hello">>`,
            + 	s`tftypes.Map[tftypes.DynamicPseudoType]<"greeting":tftypes.String<"hello">>`,
              )
    --- FAIL: TestValueFromMsgPack/tuple-dynamic (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-go/tftypes/value_msgpack_test.go:501: Unexpected results (-wanted +got):   tftypes.Value(
            - 	s`tftypes.Tuple[tftypes.String, tftypes.String]<tftypes.String<"hello">, tftypes.String<"world">>`,
            + 	s`tftypes.Tuple[tftypes.DynamicPseudoType, tftypes.DynamicPseudoType]<tftypes.String<"hello">, tftypes.String<"world">>`,
              )
    --- FAIL: TestValueFromMsgPack/dynamic-object (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-go/tftypes/value_msgpack_test.go:501: Unexpected results (-wanted +got):   tftypes.Value(
            - 	s`tftypes.Object["greeting":tftypes.String]<"greeting":tftypes.String<"hello">>`,
            + 	s`tftypes.Object["greeting":tftypes.DynamicPseudoType]<"greeting":tftypes.String<"hello">>`,
              )
```
bflad added a commit that referenced this issue Aug 16, 2021
…ing DynamicPseudoType as their type when unmarshaling msgpack values from Terraform. (#100)

Reference: #95

Previously:

```
--- FAIL: TestValueFromMsgPack (0.00s)
    --- FAIL: TestValueFromMsgPack/object-dynamic (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-go/tftypes/value_msgpack_test.go:501: Unexpected results (-wanted +got):   tftypes.Value(
            - 	s`tftypes.Object["greeting":tftypes.String]<"greeting":tftypes.String<"hello">>`,
            + 	s`tftypes.Object["greeting":tftypes.DynamicPseudoType]<"greeting":tftypes.String<"hello">>`,
              )
    --- FAIL: TestValueFromMsgPack/map-dynamic (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-go/tftypes/value_msgpack_test.go:501: Unexpected results (-wanted +got):   tftypes.Value(
            - 	s`tftypes.Map[tftypes.String]<"greeting":tftypes.String<"hello">>`,
            + 	s`tftypes.Map[tftypes.DynamicPseudoType]<"greeting":tftypes.String<"hello">>`,
              )
    --- FAIL: TestValueFromMsgPack/tuple-dynamic (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-go/tftypes/value_msgpack_test.go:501: Unexpected results (-wanted +got):   tftypes.Value(
            - 	s`tftypes.Tuple[tftypes.String, tftypes.String]<tftypes.String<"hello">, tftypes.String<"world">>`,
            + 	s`tftypes.Tuple[tftypes.DynamicPseudoType, tftypes.DynamicPseudoType]<tftypes.String<"hello">, tftypes.String<"world">>`,
              )
    --- FAIL: TestValueFromMsgPack/dynamic-object (0.00s)
        /Users/bflad/src/github.com/hashicorp/terraform-plugin-go/tftypes/value_msgpack_test.go:501: Unexpected results (-wanted +got):   tftypes.Value(
            - 	s`tftypes.Object["greeting":tftypes.String]<"greeting":tftypes.String<"hello">>`,
            + 	s`tftypes.Object["greeting":tftypes.DynamicPseudoType]<"greeting":tftypes.String<"hello">>`,
              )
```
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
2 participants