Skip to content

Commit

Permalink
Add IsSensitive to AttributeSchema
Browse files Browse the repository at this point in the history
So that sensitive attributes can be flagged.
  • Loading branch information
beandrad committed Jun 1, 2021
1 parent b62f3a9 commit 34f98c4
Show file tree
Hide file tree
Showing 3 changed files with 16 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 @@ -35,6 +35,10 @@ func detailForAttribute(attr *schema.AttributeSchema) string {
detail = "Optional"
}

if attr.IsSensitive {
detail += fmt.Sprintf(", sensitive")
}

friendlyName := attr.Expr.FriendlyName()
if friendlyName != "" {
if detail != "" {
Expand Down
2 changes: 2 additions & 0 deletions schema/attribute_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type AttributeSchema struct {
IsOptional bool
IsDeprecated bool
IsComputed bool
IsSensitive bool

Expr ExprConstraints

Expand Down Expand Up @@ -85,6 +86,7 @@ func (as *AttributeSchema) Copy() *AttributeSchema {
IsOptional: as.IsOptional,
IsDeprecated: as.IsDeprecated,
IsComputed: as.IsComputed,
IsSensitive: as.IsSensitive,
IsDepKey: as.IsDepKey,
Description: as.Description,
Expr: as.Expr.Copy(),
Expand Down
10 changes: 10 additions & 0 deletions schema/attribute_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ func TestAttributeSchema_Validate(t *testing.T) {
},
nil,
},
{
&AttributeSchema{
Expr: ExprConstraints{
TraversalExpr{OfType: cty.Number, OfScopeId: lang.ScopeId("blah")},
},
IsRequired: true,
IsSensitive: true,
},
nil,
},
}

for i, tc := range testCases {
Expand Down

0 comments on commit 34f98c4

Please sign in to comment.