Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
  • Loading branch information
ulucinar committed May 20, 2024
1 parent 92d1af8 commit 410625f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/resource/sensitive.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func GetSensitiveAttributes(from map[string]any, mapping map[string]string) (map
// Note(turkenh): k8s secrets uses a strict regex to validate secret
// keys which does not allow having brackets inside. So, we need to
// do a conversion to be able to store as connection secret keys.
// See https://github.com/crossplane/upjet/pull/94 for
// See https://github.com/crossplane/terrajet/pull/94 for
// more details.
k, err := fieldPathToSecretKey(fp)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion pkg/types/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ type Field struct {
// Injected is set if this Field is an injected field to the Terraform
// schema as an object list map key for server-side apply merges.
Injected bool
// Sensitive is set if this Field holds sensitive data and is thus
// generated as a secret reference.
Sensitive bool
}

// getDocString tries to extract the documentation string for the specified
Expand Down Expand Up @@ -268,6 +271,7 @@ func NewSensitiveField(g *Builder, cfg *config.Resource, r *resource, sch *schem
if err != nil {
return nil, false, err
}
f.Sensitive = true

if IsObservation(f.Schema) {
cfg.Sensitive.AddFieldPath(traverser.FieldPathWithWildcard(f.TerraformPaths), "status.atProvider."+traverser.FieldPathWithWildcard(f.CRDPaths))
Expand Down Expand Up @@ -415,7 +419,7 @@ func (f *Field) AddToResource(g *Builder, r *resource, typeNames *TypeNames, add
// an earlier step, so they cannot be included as well. Plus probably they
// should also not change for Create and Update steps.
func (f *Field) isInit() bool {
return !f.Identifier && (f.TFTag != "-" || f.Injected)
return !f.Identifier && (f.TFTag != "-" || f.Injected || f.Sensitive)
}

func getDescription(s string) string {
Expand Down

0 comments on commit 410625f

Please sign in to comment.