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

(WIP) Add tests for DynamicPseudoType behavior #208

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a470dab
add testsdk and testprovider from plugin-testing
austinvalle Jan 19, 2024
4dbe03a
add test for dynamic tuple literal
austinvalle Jan 19, 2024
f9d4c72
finished literal tests
austinvalle Jan 23, 2024
19980cf
license headers
austinvalle Jan 23, 2024
6f43a9e
add dynamic6provider tests
austinvalle Jan 23, 2024
9666b03
dynamic in workflow
austinvalle Jan 23, 2024
e312501
implement dynamic state type checking
austinvalle Jan 23, 2024
190ffa9
update type change in state test
austinvalle Jan 23, 2024
972e82a
comment out config plan check
austinvalle Jan 23, 2024
366bb5b
tf 1.0 issues
austinvalle Jan 23, 2024
93a3959
add skip for terraform version 1.0
austinvalle Jan 23, 2024
b23bcdc
skip below
austinvalle Jan 23, 2024
a35ccd9
add comment on why test fails
austinvalle Jan 23, 2024
9fdb4b9
add plan/state changing type negative tests
austinvalle Jan 24, 2024
8f0ea23
doc
austinvalle Jan 24, 2024
f54d8ac
add bug recreation of 267
austinvalle Jan 24, 2024
d31232b
add copywrite license
austinvalle Jan 25, 2024
c6d8c74
add set test showing invalid usage
austinvalle Jan 25, 2024
45044a7
rename file
austinvalle Jan 29, 2024
8afcae8
update tests and add comments
austinvalle Jan 29, 2024
39fd893
ignore set validation tests on 1.1.x and 1.0.x
austinvalle Jan 29, 2024
fd4a3a3
change name of file
austinvalle Jan 29, 2024
0a4b8ee
name again
austinvalle Jan 29, 2024
0f7507e
fix skips and add tests for types
austinvalle Jan 29, 2024
98dfbbe
add compliance header
austinvalle Jan 30, 2024
8db9c77
rename file
austinvalle Jan 30, 2024
8e75137
add tests for object types
austinvalle Jan 30, 2024
2639111
add tuple type example
austinvalle Jan 30, 2024
fb62de7
add null to new type test
austinvalle Jan 30, 2024
39c75a6
add function tests
austinvalle Jan 30, 2024
3bd7fd9
add import test
austinvalle Jan 30, 2024
80296bd
Merge branch 'main' into av/dpt-testing
austinvalle Jan 30, 2024
10f3778
update to latest branch
austinvalle Jan 30, 2024
95d52c2
fix import test
austinvalle Jan 31, 2024
612e588
fix test names
austinvalle Jan 31, 2024
0fd1b90
verify the value of literals match as well
austinvalle Jan 31, 2024
5c36673
remove dynamic built-in function test
austinvalle Jan 31, 2024
9c5c8d0
add state checks to all successful test cases
austinvalle Jan 31, 2024
beaf6db
add multiple elements to list, set, and map tests
austinvalle Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
- run: go mod download
- run: go test -v -cover ./internal/framework5provider/
- run: go test -v -cover ./internal/protocolprovider/
# - run: go test -v -cover ./internal/dynamic5provider/
- run: go test -v -cover ./internal/sdkv2provider/
env:
TF_ACC: "1"
Expand Down Expand Up @@ -96,6 +97,7 @@ jobs:
- run: go mod download
- run: go test -v -cover ./internal/framework6provider/
- run: go test -v -cover ./internal/protocolv6provider/
- run: go test -v -cover ./internal/dynamic6provider/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to not expand our packages here and use protocol(v6)provider because it means updating the terraform-plugin-go CI and I'm not sure it offers much benefit over having all the terraform-plugin-go tests in one package per protocol version. Maybe we can introduce the testsdk and update the existing provider in a separate PR, then the dynamic tests are additive to the existing provider?

Copy link
Member Author

@austinvalle austinvalle Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good shout and will make even more sense once framework implements dynamic types and we add tests for that.

I think I can wait for @bendbennett's work on #210 to merge, then will add all my tests to the protocolv6provider + protocolprovider and switch them all to using the testsdk.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#210 is almost complete with the exception of dealing with hashicorp/terraform-plugin-framework#914. I'll be looking into that imminently, but don't let me hold you up in terms of merging this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't plan on opening this PR for review until the dynamic type work in terraform-plugin-framework is nearing completion (which I just started), so I think we still have some time, whoever gets to it first 😆

After that work is done, I want to make sure we also have a discussion with the core team to ensure we aren't exposing dynamics in any way that could be invalid/confusing.

- # Terraform CLI 1.1.5+ is required for upgrading sdk/v2
if: matrix.terraform != '1.0.*'
run: go test -v -cover ./internal/tf5to6provider/
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/hashicorp/terraform-plugin-go v0.21.0
github.com/hashicorp/terraform-plugin-mux v0.14.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.32.0
github.com/hashicorp/terraform-plugin-testing v1.6.0
github.com/hashicorp/terraform-plugin-testing v1.6.1-0.20240130155516-51777dda582e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll tag a release once we've finalised and merged hashicorp/terraform-plugin-testing#276

)

require (
Expand All @@ -24,7 +24,7 @@ require (
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-hclog v1.6.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
Expand Down Expand Up @@ -53,7 +53,6 @@ require (
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.14.2 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.16.0 // indirect
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I=
github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-immutable-radix v1.3.0 h1:8exGP7ego3OmkfksihtSouGMZ+hQrhxx+FVELeXpVPE=
github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-memdb v1.3.4 h1:XSL3NR682X/cVk2IeV0d70N4DZ9ljI885xAEU8IoK3c=
Expand Down Expand Up @@ -82,8 +82,8 @@ github.com/hashicorp/terraform-plugin-mux v0.14.0 h1:+UeiTaYy8zPAk1pktNRp3288pIi
github.com/hashicorp/terraform-plugin-mux v0.14.0/go.mod h1:UzkNhewtpuqSnBvo1ZXSagAxu+hQ+Ir3F5Mpm86dWn0=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.32.0 h1:7xdO9aOXVmhvMxNAq8UloyyqW0EEzyAY37llSTHJgjo=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.32.0/go.mod h1:LxQzs7AQl/5JE1IGFd6LX8E4A0InRJ/7s245gOmsejA=
github.com/hashicorp/terraform-plugin-testing v1.6.0 h1:Wsnfh+7XSVRfwcr2jZYHsnLOnZl7UeaOBvsx6dl/608=
github.com/hashicorp/terraform-plugin-testing v1.6.0/go.mod h1:cJGG0/8j9XhHaJZRC+0sXFI4uzqQZ9Az4vh6C4GJpFE=
github.com/hashicorp/terraform-plugin-testing v1.6.1-0.20240130155516-51777dda582e h1:6czChA67L9obTTF/xPbF6oaWW5nk2X6h9DKFUWHOTPo=
github.com/hashicorp/terraform-plugin-testing v1.6.1-0.20240130155516-51777dda582e/go.mod h1:6Gh6cfB8R8hv59hkcdWFjFjt3Mrbf4OrzWBC5moirNE=
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM=
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
Expand Down Expand Up @@ -142,8 +142,6 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U=
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
Expand Down
5 changes: 5 additions & 0 deletions internal/dynamic6provider/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// dynamic6provider contains tests that verify the behavior of DynamicPseudoType in terraform-plugin-go
package dynamic6provider
253 changes: 253 additions & 0 deletions internal/dynamic6provider/dynamic_element_type_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package dynamic6provider_test

import (
"testing"

"github.com/hashicorp/terraform-plugin-go/tfprotov6"
"github.com/hashicorp/terraform-plugin-go/tftypes"
r "github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/knownvalue"
"github.com/hashicorp/terraform-plugin-testing/statecheck"
"github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
"github.com/hashicorp/terraform-provider-corner/internal/testing/testprovider"
"github.com/hashicorp/terraform-provider-corner/internal/testing/testsdk/providerserver"
"github.com/hashicorp/terraform-provider-corner/internal/testing/testsdk/resource"
)

func Test_Dynamic_Attribute_ListType(t *testing.T) {
r.UnitTest(t, r.TestCase{
Steps: []r.TestStep{
{
// This may eventually be considered an invalid schema. It currently behaves as expected but may not be exposed to provider developers
// to avoid confusion. While the element type is dynamic, all elements must still have the exact same type, which Terraform will achieve
// by either performing a conversion (like below, converting 12345 to "12345"), or throw an error if conversion is impossible, for example:
//
// Error: Incorrect attribute value type
//
// on terraform_plugin_test.tf line 12, in resource "corner_dynamic_thing" "foo":
// 12: attribute_with_dpt = ["hey", { number = 12345 }]
//
// Inappropriate value for attribute "attribute_with_dpt": all list elements must have the same type.
//
// Related issue: https://github.com/hashicorp/terraform/issues/34574
Config: `resource "corner_dynamic_thing" "foo" {
attribute_with_dpt = ["hey", 12345]
}`,
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue(
"corner_dynamic_thing.foo",
tfjsonpath.New("attribute_with_dpt"),
knownvalue.ListExact([]knownvalue.Check{
knownvalue.StringExact("hey"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not be appropriate for this PR, or this repo even, but if it's not documented somewhere, is it worth providing some information about the rules that Terraform applies when there is ambiguity in the types specified in configuration, in this instance a string and an integer, and how that is handled in the context of a attributes that use tftypes.DynamicPseudoType? Does Terraform take the first value (i.e., "hey"), determine that it is a string, then determine if all of the subsequent values in the list can be converted to a string?

Copy link
Member Author

@austinvalle austinvalle Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's documented in the context you're describing, but it is an interesting thought I also share.

Just observing the behavior of Terraform/cty it looks potentially arbitrary, but digging more into cty documentation, I believe it may just be following the only safe conversion route possible: https://github.com/zclconf/go-cty/blob/main/docs/convert.md#conversion-charts

  • The literal representation of this specific test config is known to Terraform as: tuple[string, number]
  • The schema we defined tells Terraform/cty that it needs to be converted to a list, which has a single element type that is not determined (DynamicPseudoType)
  • Terraform needs to determine the element type, so it needs to find a safe route to converge [string, number]. Which the only safe option according to that table is string

If we switch the config around to:

resource "corner_dynamic_thing" "foo" {
  attribute_with_dpt = [12345, "hey"]
}

We receive the same element type as string from the msgpack config:

{
  "attribute_with_dpt": [
    [
      "\"string\"",
      "12345"
    ],
    [
      "\"string\"",
      "hey"
    ]
  ]
}

It would be nice to get some confirmation on this behavior, so I will note this down as something to ask the core team so we can understand a little deeper 👍🏻

knownvalue.StringExact("12345"),
}),
),
},
},
},
ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){
"corner": providerserver.NewProviderServer(testprovider.Provider{
Resources: map[string]testprovider.Resource{
"corner_dynamic_thing": {
SchemaResponse: &resource.SchemaResponse{
Schema: &tfprotov6.Schema{
Block: &tfprotov6.SchemaBlock{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I spend far more time looking at a schema at the "Framework-level", scanning Block: ... always makes me think, hang on a minute, given the config that's being used this isn't a block, it's an attribute. Always makes me think of Plugin Protocol v6: What is a block, even?.

Attributes: []*tfprotov6.SchemaAttribute{
{
Name: "attribute_with_dpt",
Required: true,
Type: tftypes.List{
ElementType: tftypes.DynamicPseudoType,
},
},
},
},
},
},
},
},
}),
},
})
}

func Test_Dynamic_Attribute_MapType(t *testing.T) {
r.UnitTest(t, r.TestCase{
Steps: []r.TestStep{
{
// This may eventually be considered an invalid schema. It currently behaves as expected but may not be exposed to provider developers
// to avoid confusion. While the element type is dynamic, all elements must still have the exact same type, which Terraform will achieve
// by either performing a conversion (like below, converting 12345 to "12345"), or throw an error if conversion is impossible, for example:
//
// Error: Incorrect attribute value type
//
// on terraform_plugin_test.tf line 12, in resource "corner_dynamic_thing" "foo":
// attribute_with_dpt = {
// "key1" = "hey"
// "key2" = {
// number = 12345
// }
// }
//
// Inappropriate value for attribute "attribute_with_dpt": all map elements must have the same type.
//
// Related issue: https://github.com/hashicorp/terraform/issues/34574
Comment on lines +81 to +97
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ the extensive notes/documentation.

Config: `resource "corner_dynamic_thing" "foo" {
attribute_with_dpt = {
"key1" = "hey"
"key2" = 12345
}
}`,
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue(
"corner_dynamic_thing.foo",
tfjsonpath.New("attribute_with_dpt"),
knownvalue.MapExact(map[string]knownvalue.Check{
"key1": knownvalue.StringExact("hey"),
"key2": knownvalue.StringExact("12345"),
}),
),
},
},
},
ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){
"corner": providerserver.NewProviderServer(testprovider.Provider{
Resources: map[string]testprovider.Resource{
"corner_dynamic_thing": {
SchemaResponse: &resource.SchemaResponse{
Schema: &tfprotov6.Schema{
Block: &tfprotov6.SchemaBlock{
Attributes: []*tfprotov6.SchemaAttribute{
{
Name: "attribute_with_dpt",
Required: true,
Type: tftypes.Map{
ElementType: tftypes.DynamicPseudoType,
},
},
},
},
},
},
},
},
}),
},
})
}

func Test_Dynamic_Attribute_SetType(t *testing.T) {
r.UnitTest(t, r.TestCase{
Steps: []r.TestStep{
{
// This may eventually be considered an invalid schema. It currently behaves as expected but may not be exposed to provider developers
// to avoid confusion. While the element type is dynamic, all elements must still have the exact same type, which Terraform will achieve
// by either performing a conversion (like below, converting 12345 to "12345"), or throw an error if conversion is impossible, for example:
//
// Error: Incorrect attribute value type
//
// on terraform_plugin_test.tf line 12, in resource "corner_dynamic_thing" "foo":
// attribute_with_dpt = ["hey", { number = 12345 }]
//
// Inappropriate value for attribute "attribute_with_dpt": all set elements must have the same type.
//
// Related issue: https://github.com/hashicorp/terraform/issues/34574
Config: `resource "corner_dynamic_thing" "foo" {
attribute_with_dpt = ["hey", 12345]
}`,
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue(
"corner_dynamic_thing.foo",
tfjsonpath.New("attribute_with_dpt"),
knownvalue.SetExact([]knownvalue.Check{
knownvalue.StringExact("hey"),
knownvalue.StringExact("12345"),
}),
),
},
},
},
ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){
"corner": providerserver.NewProviderServer(testprovider.Provider{
Resources: map[string]testprovider.Resource{
"corner_dynamic_thing": {
SchemaResponse: &resource.SchemaResponse{
Schema: &tfprotov6.Schema{
Block: &tfprotov6.SchemaBlock{
Attributes: []*tfprotov6.SchemaAttribute{
{
Name: "attribute_with_dpt",
Required: true,
Type: tftypes.Set{
ElementType: tftypes.DynamicPseudoType,
},
},
},
},
},
},
},
},
}),
},
})
}

func Test_Dynamic_Attribute_TupleType(t *testing.T) {
r.UnitTest(t, r.TestCase{
Steps: []r.TestStep{
{
Config: `resource "corner_dynamic_thing" "foo" {
attribute_with_dpt = ["hey", { number = 12345 }, ["there", "tuple"]]
}`,
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue(
"corner_dynamic_thing.foo",
tfjsonpath.New("attribute_with_dpt"),
// The type is stored as a tuple, but we can still use `ListExact` to verify state
knownvalue.ListExact([]knownvalue.Check{
knownvalue.StringExact("hey"),
knownvalue.ObjectExact(map[string]knownvalue.Check{
"number": knownvalue.Int64Exact(12345),
}),
knownvalue.ListExact([]knownvalue.Check{
knownvalue.StringExact("there"),
knownvalue.StringExact("tuple"),
}),
}),
Comment on lines +210 to +220
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bflad @bendbennett I hesitate to suggest we add a TupleExact, but just wanted to point out that this works fine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. If there are legitimate use-cases for TupleExact then perhaps we can add this in going forwards.

),
},
},
},
ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){
"corner": providerserver.NewProviderServer(testprovider.Provider{
Resources: map[string]testprovider.Resource{
"corner_dynamic_thing": {
SchemaResponse: &resource.SchemaResponse{
Schema: &tfprotov6.Schema{
Block: &tfprotov6.SchemaBlock{
Attributes: []*tfprotov6.SchemaAttribute{
{
Name: "attribute_with_dpt",
Required: true,
Type: tftypes.Tuple{
ElementTypes: []tftypes.Type{
tftypes.String,
tftypes.DynamicPseudoType,
tftypes.DynamicPseudoType,
Comment on lines +239 to +240
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to this PR, but given that within terraform-plugin-go, tftypes.DynamicPseudoType is defined as a primitive, it seems a little odd that it can be used for any Terraform type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I think the documentation and wording will be important for framework developers to understand. As described by cty, it's a placeholder for a type that will eventually be determined, "pseudo-type": https://github.com/zclconf/go-cty/blob/main/docs/types.md#the-dynamic-pseudo-type.

One consequence of this being a "pseudo-type" is that there is no known, non-null value of this type

},
},
},
},
},
},
},
},
},
}),
},
})
}
Loading
Loading