hclsyntax: Test for interpolating from marked map
This commit is contained in:
parent
35ad93007d
commit
8eccdca8f9
@ -287,7 +287,7 @@ trim`,
|
|||||||
`hello%{ if false } ${target}%{ endif }`,
|
`hello%{ if false } ${target}%{ endif }`,
|
||||||
&hcl.EvalContext{
|
&hcl.EvalContext{
|
||||||
Variables: map[string]cty.Value{
|
Variables: map[string]cty.Value{
|
||||||
"target": cty.StringVal("world").WithMarks(cty.NewValueMarks("sensitive")),
|
"target": cty.StringVal("world").Mark("sensitive"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cty.StringVal("hello"),
|
cty.StringVal("hello"),
|
||||||
@ -297,13 +297,25 @@ trim`,
|
|||||||
`${greeting} ${target}`,
|
`${greeting} ${target}`,
|
||||||
&hcl.EvalContext{
|
&hcl.EvalContext{
|
||||||
Variables: map[string]cty.Value{
|
Variables: map[string]cty.Value{
|
||||||
"greeting": cty.StringVal("hello").WithMarks(cty.NewValueMarks("english")),
|
"greeting": cty.StringVal("hello").Mark("english"),
|
||||||
"target": cty.StringVal("world").WithMarks(cty.NewValueMarks("sensitive")),
|
"target": cty.StringVal("world").Mark("sensitive"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cty.StringVal("hello world").WithMarks(cty.NewValueMarks("english", "sensitive")),
|
cty.StringVal("hello world").WithMarks(cty.NewValueMarks("english", "sensitive")),
|
||||||
0,
|
0,
|
||||||
},
|
},
|
||||||
|
{ // can use marks by traversing complex values
|
||||||
|
`Authenticate with "${secrets.passphrase}"`,
|
||||||
|
&hcl.EvalContext{
|
||||||
|
Variables: map[string]cty.Value{
|
||||||
|
"secrets": cty.MapVal(map[string]cty.Value{
|
||||||
|
"passphrase": cty.StringVal("my voice is my passport").Mark("sensitive"),
|
||||||
|
}).Mark("sensitive"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cty.StringVal(`Authenticate with "my voice is my passport"`).WithMarks(cty.NewValueMarks("sensitive")),
|
||||||
|
0,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user