github.com/terraform-linters/tflint@v0.51.2-0.20240520175844-3750771571b6/terraform/lang/funcs/redact.go (about) 1 package funcs 2 3 import ( 4 "fmt" 5 6 "github.com/terraform-linters/tflint-plugin-sdk/terraform/lang/marks" 7 "github.com/zclconf/go-cty/cty" 8 ) 9 10 func redactIfSensitive(value interface{}, markses ...cty.ValueMarks) string { 11 if marks.Has(cty.DynamicVal.WithMarks(markses...), marks.Sensitive) { 12 return "(sensitive value)" 13 } 14 switch v := value.(type) { 15 case string: 16 return fmt.Sprintf("%q", v) 17 default: 18 return fmt.Sprintf("%v", v) 19 } 20 }