Skip to content

Commit

Permalink
backport of commit efb3f30
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcervante committed Dec 16, 2022
1 parent 475ef83 commit 354a743
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions internal/terraform/eval_variable_test.go
Expand Up @@ -180,6 +180,18 @@ func TestPrepareFinalInputVariableValue(t *testing.T) {
}
]
}
// https://github.com/hashicorp/terraform/issues/32396
// This variable was originally introduced to test the behaviour of the
// dynamic type constraint. You should be able to set primitive types in
// the list consistently.
variable "list_with_nested_collections_dynamic_with_default" {
type = list(
object({
name = optional(string, "default")
taints = optional(list(map(any)), [])
})
)
}
`
cfg := testModuleInline(t, map[string]string{
"main.tf": cfgSrc,
Expand Down Expand Up @@ -714,6 +726,39 @@ func TestPrepareFinalInputVariableValue(t *testing.T) {
}),
``,
},
{
"list_with_nested_collections_dynamic_with_default",
cty.TupleVal([]cty.Value{
cty.ObjectVal(map[string]cty.Value{
"name": cty.StringVal("default"),
}),
cty.ObjectVal(map[string]cty.Value{
"name": cty.StringVal("complex"),
"taints": cty.ListVal([]cty.Value{
cty.MapVal(map[string]cty.Value{
"key": cty.StringVal("my_key"),
"value": cty.StringVal("my_value"),
}),
}),
}),
}),
cty.ListVal([]cty.Value{
cty.ObjectVal(map[string]cty.Value{
"name": cty.StringVal("default"),
"taints": cty.ListValEmpty(cty.Map(cty.String)),
}),
cty.ObjectVal(map[string]cty.Value{
"name": cty.StringVal("complex"),
"taints": cty.ListVal([]cty.Value{
cty.MapVal(map[string]cty.Value{
"key": cty.StringVal("my_key"),
"value": cty.StringVal("my_value"),
}),
}),
}),
}),
``,
},

// sensitive
{
Expand Down

0 comments on commit 354a743

Please sign in to comment.