diff --git a/go.mod b/go.mod index 2f77960..b81a62e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.0 - github.com/hashicorp/terraform-plugin-framework v0.13.0 + github.com/hashicorp/terraform-plugin-framework v0.14.0 github.com/hashicorp/terraform-plugin-go v0.14.0 ) diff --git a/go.sum b/go.sum index a0768c8..56b38a2 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/terraform-plugin-framework v0.13.0 h1:tGnqttzZwU3FKc+HasHr2Yi5L81FcQbdc8zQhbBD9jQ= -github.com/hashicorp/terraform-plugin-framework v0.13.0/go.mod h1:wcZdk4+Uef6Ng+BiBJjGAcIPlIs5bhlEV/TA1k6Xkq8= +github.com/hashicorp/terraform-plugin-framework v0.14.0 h1:Mwj55u+Jc/QGM6fLBPCe1P+ZF3cuYs6wbCdB15lx/Dg= +github.com/hashicorp/terraform-plugin-framework v0.14.0/go.mod h1:wcZdk4+Uef6Ng+BiBJjGAcIPlIs5bhlEV/TA1k6Xkq8= github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4= github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= diff --git a/uuidtypes/uuid_type.go b/uuidtypes/uuid_type.go index 06f7f01..209ee5a 100644 --- a/uuidtypes/uuid_type.go +++ b/uuidtypes/uuid_type.go @@ -110,3 +110,8 @@ func (u UUIDType) ValueFromTerraform(_ context.Context, value tftypes.Value) (at return UUIDFromGoogleUUID(parsedUUID), nil } + +// ValueType returns attr.Value type returned by ValueFromTerraform. +func (u UUIDType) ValueType(context.Context) attr.Value { + return UUID{} +} diff --git a/uuidtypes/uuid_type_test.go b/uuidtypes/uuid_type_test.go index e91589d..53a8aa1 100644 --- a/uuidtypes/uuid_type_test.go +++ b/uuidtypes/uuid_type_test.go @@ -412,3 +412,37 @@ func TestType_ValueFromTerraform(t *testing.T) { }) } } + +func TestUUIDType_ValueType(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + value uuidtypes.UUIDType + expected attr.Value + }{ + { + name: "always", + value: uuidtypes.UUIDType{}, + expected: uuidtypes.UUID{}, + }, + } + for _, testcase := range tests { + testcase := testcase + + t.Run(testcase.name, func(t *testing.T) { + t.Parallel() + + got := testcase.value.ValueType(context.Background()) + + if diff := cmp.Diff(got, testcase.expected); diff != "" { + t.Errorf( + "Type()\ngot : %v\nexpected: %v\ndiff: %v\n", + got, + testcase.expected, + diff, + ) + } + }) + } +}