Skip to content

Commit aa58f1a

Browse files
sergenyalcingithub-actions[bot]
authored andcommitted
Fix non-primitive type sensitive field generation
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com> (cherry picked from commit 8bf78e8)
1 parent 247b2d2 commit aa58f1a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

pkg/types/field.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,13 @@ func NewSensitiveField(g *Builder, cfg *config.Resource, r *resource, sch *schem
268268
return nil, true, nil
269269
}
270270
sfx := "SecretRef"
271-
cfg.Sensitive.AddFieldPath(fieldPathWithWildcard(f.TerraformPaths), "spec.forProvider."+fieldPathWithWildcard(f.CRDPaths)+sfx)
271+
switch f.FieldType.String() {
272+
case "string", "*string", "map[string]string", "map[string]*string":
273+
cfg.Sensitive.AddFieldPath(fieldPathWithWildcard(f.TerraformPaths), "spec.forProvider."+fieldPathWithWildcard(f.CRDPaths)+sfx)
274+
case "[]string", "[]*string":
275+
f.CRDPaths[len(f.CRDPaths)-2] = f.CRDPaths[len(f.CRDPaths)-2] + sfx
276+
cfg.Sensitive.AddFieldPath(fieldPathWithWildcard(f.TerraformPaths), "spec.forProvider."+fieldPathWithWildcard(f.CRDPaths))
277+
}
272278
// todo(turkenh): do we need to support other field types as sensitive?
273279
if f.FieldType.String() != "string" && f.FieldType.String() != "*string" && f.FieldType.String() != "[]string" &&
274280
f.FieldType.String() != "[]*string" && f.FieldType.String() != "map[string]string" && f.FieldType.String() != "map[string]*string" {

0 commit comments

Comments
 (0)