Skip to content

Commit e30d582

Browse files
committed
Add schema.EmptyValue() implementation to ephemeral/schema and resource/identityschema
1 parent 61cf7c3 commit e30d582

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

ephemeral/schema/schema.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ type Schema struct {
6161
DeprecationMessage string
6262
}
6363

64+
func (s Schema) EmptyValue(ctx context.Context) tftypes.Value {
65+
return fwschema.EmptySchemaValue(ctx, s)
66+
}
67+
6468
// ApplyTerraform5AttributePathStep applies the given AttributePathStep to the
6569
// schema.
6670
func (s Schema) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (any, error) {

internal/fwschema/schema.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type Schema interface {
7474
// the given Terraform path or return an error.
7575
TypeAtTerraformPath(context.Context, *tftypes.AttributePath) (attr.Type, error)
7676

77+
// EmptyValue should return an empty tftypes.Value of the schema's TerraformType
7778
EmptyValue(context.Context) tftypes.Value
7879
}
7980

resource/identityschema/schema.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ type Schema struct {
3737
Version int64
3838
}
3939

40+
func (s Schema) EmptyValue(ctx context.Context) tftypes.Value {
41+
return fwschema.EmptySchemaValue(ctx, s)
42+
}
43+
4044
// ApplyTerraform5AttributePathStep applies the given AttributePathStep to the
4145
// schema.
4246
func (s Schema) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (any, error) {

0 commit comments

Comments
 (0)