github.com/graywolf-at-work-2/terraform-vendor@v1.4.5/internal/lang/funcs/redact.go (about)

     1  package funcs
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/terraform/internal/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  }