mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
add marks.Raw
This commit is contained in:
parent
55ebb2708c
commit
80ef795cbf
@ -109,7 +109,7 @@ var TypeFunc = function.New(&function.Spec{
|
|||||||
},
|
},
|
||||||
Type: function.StaticReturnType(cty.String),
|
Type: function.StaticReturnType(cty.String),
|
||||||
Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {
|
Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {
|
||||||
return cty.StringVal(TypeString(args[0].Type())).Mark("raw"), nil
|
return cty.StringVal(TypeString(args[0].Type())).Mark(marks.Raw), nil
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -37,3 +37,7 @@ func Contains(val cty.Value, mark valueMark) bool {
|
|||||||
// Sensitive indicates that this value is marked as sensitive in the context of
|
// Sensitive indicates that this value is marked as sensitive in the context of
|
||||||
// Terraform.
|
// Terraform.
|
||||||
var Sensitive = valueMark("sensitive")
|
var Sensitive = valueMark("sensitive")
|
||||||
|
|
||||||
|
// Raw is used to indicate to the repl that the value should be written without
|
||||||
|
// any formatting.
|
||||||
|
var Raw = valueMark("raw")
|
||||||
|
@ -17,7 +17,7 @@ func FormatValue(v cty.Value, indent int) string {
|
|||||||
if !v.IsKnown() {
|
if !v.IsKnown() {
|
||||||
return "(known after apply)"
|
return "(known after apply)"
|
||||||
}
|
}
|
||||||
if v.Type().Equals(cty.String) && v.HasMark("raw") {
|
if v.Type().Equals(cty.String) && v.HasMark(marks.Raw) {
|
||||||
raw, _ := v.Unmark()
|
raw, _ := v.Unmark()
|
||||||
return raw.AsString()
|
return raw.AsString()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user