diff --git a/pkg/pf/internal/pfutils/attr.go b/pkg/pf/internal/pfutils/attr.go index c1e6f8591..0b6899350 100644 --- a/pkg/pf/internal/pfutils/attr.go +++ b/pkg/pf/internal/pfutils/attr.go @@ -45,17 +45,13 @@ type AttrLike interface { IsOptional() bool IsRequired() bool IsSensitive() bool + IsWriteOnly() bool GetDeprecationMessage() string GetDescription() string GetMarkdownDescription() string GetType() attr.Type } -type AttrLikeWithWriteOnly interface { - AttrLike - IsWriteOnly() bool -} - func FromProviderAttribute(x pschema.Attribute) Attr { return FromAttrLike(x) } diff --git a/pkg/pf/internal/schemashim/attr_schema.go b/pkg/pf/internal/schemashim/attr_schema.go index b43dcbda5..250af55ea 100644 --- a/pkg/pf/internal/schemashim/attr_schema.go +++ b/pkg/pf/internal/schemashim/attr_schema.go @@ -142,11 +142,7 @@ func (s *attrSchema) Sensitive() bool { } func (s *attrSchema) WriteOnly() bool { - schema, ok := s.attr.(pfutils.AttrLikeWithWriteOnly) - if ok { - return schema.IsWriteOnly() - } - return false + return s.attr.IsWriteOnly() } func (*attrSchema) SetElement(config interface{}) (interface{}, error) { diff --git a/pkg/pf/internal/schemashim/object_pseudoresource.go b/pkg/pf/internal/schemashim/object_pseudoresource.go index 2c706279e..c26f9c9e4 100644 --- a/pkg/pf/internal/schemashim/object_pseudoresource.go +++ b/pkg/pf/internal/schemashim/object_pseudoresource.go @@ -180,6 +180,7 @@ func (tupElementAttr) IsOptional() bool { return false } func (tupElementAttr) IsRequired() bool { return true } func (tupElementAttr) IsSensitive() bool { return false } func (tupElementAttr) IsComputed() bool { return false } +func (tupElementAttr) IsWriteOnly() bool { return false } func (t tupElementAttr) GetType() attr.Type { return t.e } diff --git a/pkg/pf/tfgen/testdata/TestWriteOnlyOmit.golden b/pkg/pf/tfgen/testdata/TestWriteOnlyOmit.golden index 2878d2fc7..aeab1c1f1 100644 --- a/pkg/pf/tfgen/testdata/TestWriteOnlyOmit.golden +++ b/pkg/pf/tfgen/testdata/TestWriteOnlyOmit.golden @@ -12,23 +12,8 @@ }, "resources": { "testprovider:index:Res": { - "properties": { - "a1": { - "type": "string" - } - }, - "inputProperties": { - "a1": { - "type": "string" - } - }, "stateInputs": { "description": "Input properties used for looking up and filtering Res resources.\n", - "properties": { - "a1": { - "type": "string" - } - }, "type": "object" } }