Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit ef1fcf5

Browse files
feat(uuidtypes): adds support for github.com/hashicorp/[email protected].
1 parent beee762 commit ef1fcf5

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

uuidtypes/uuid_type.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,8 @@ func (u UUIDType) ValueFromTerraform(_ context.Context, value tftypes.Value) (at
110110

111111
return UUIDFromGoogleUUID(parsedUUID), nil
112112
}
113+
114+
// ValueType returns attr.Value type returned by ValueFromTerraform.
115+
func (u UUIDType) ValueType(context.Context) attr.Value {
116+
return UUID{}
117+
}

uuidtypes/uuid_type_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,3 +412,37 @@ func TestType_ValueFromTerraform(t *testing.T) {
412412
})
413413
}
414414
}
415+
416+
func TestUUIDType_ValueType(t *testing.T) {
417+
t.Parallel()
418+
419+
tests := []struct {
420+
name string
421+
value uuidtypes.UUIDType
422+
expected attr.Value
423+
}{
424+
{
425+
name: "always",
426+
value: uuidtypes.UUIDType{},
427+
expected: uuidtypes.UUID{},
428+
},
429+
}
430+
for _, testcase := range tests {
431+
testcase := testcase
432+
433+
t.Run(testcase.name, func(t *testing.T) {
434+
t.Parallel()
435+
436+
got := testcase.value.ValueType(context.Background())
437+
438+
if diff := cmp.Diff(got, testcase.expected); diff != "" {
439+
t.Errorf(
440+
"Type()\ngot : %v\nexpected: %v\ndiff: %v\n",
441+
got,
442+
testcase.expected,
443+
diff,
444+
)
445+
}
446+
})
447+
}
448+
}

0 commit comments

Comments
 (0)