Skip to content

Commit

Permalink
(TFECO-7724) Support write only attributes in schema (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpogran authored Jan 10, 2025
1 parent a0a35e5 commit daa3bfe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions decoder/attribute_candidates.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func attributeSchemaToCandidate(ctx context.Context, name string, attr *schema.A
func detailForAttribute(attr *schema.AttributeSchema) string {
details := []string{}

if attr.IsWriteOnly {
details = append(details, "write-only")
}

if attr.IsRequired {
details = append(details, "required")
} else if attr.IsOptional {
Expand Down
5 changes: 5 additions & 0 deletions schema/attribute_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ type AttributeSchema struct {
IsComputed bool
IsSensitive bool

// If true, this attribute is write only and its value will not be
// persisted in artifacts such as plan files or state.
IsWriteOnly bool

// Constraint represents expression constraint e.g. what types of
// expressions are expected for the attribute
//
Expand Down Expand Up @@ -139,6 +143,7 @@ func (as *AttributeSchema) Copy() *AttributeSchema {
IsDeprecated: as.IsDeprecated,
IsComputed: as.IsComputed,
IsSensitive: as.IsSensitive,
IsWriteOnly: as.IsWriteOnly,
IsDepKey: as.IsDepKey,
DefaultValue: as.DefaultValue,
Description: as.Description,
Expand Down

0 comments on commit daa3bfe

Please sign in to comment.