Skip to content

Commit

Permalink
Add test case for tuple and object
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanck committed Oct 27, 2023
1 parent 200678b commit a5e0efe
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions schema/variable_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,49 @@ func TestSchemaForVariables(t *testing.T) {
},
}},
},
{
"attribute with type from default value object and tuple",
map[string]module.Variable{
"name": {
Description: "name of the module",
Type: cty.DynamicPseudoType,
DefaultValue: cty.ObjectVal(map[string]cty.Value{"foo": cty.StringVal("bar")}),
},
"id": {
Description: "id of the module",
Type: cty.DynamicPseudoType,
DefaultValue: cty.TupleVal([]cty.Value{cty.NumberIntVal(42)}),
},
},
&schema.BodySchema{Attributes: map[string]*schema.AttributeSchema{
"name": {
Description: lang.MarkupContent{
Value: "name of the module",
Kind: lang.PlainTextKind,
},
IsOptional: true,
Constraint: schema.LiteralType{Type: cty.DynamicPseudoType},
OriginForTarget: &schema.PathTarget{
Address: schema.Address{schema.StaticStep{Name: "var"}, schema.AttrNameStep{}},
Path: lang.Path{Path: "./local", LanguageID: "terraform"},
Constraints: schema.Constraints{ScopeId: "variable", Type: cty.DynamicPseudoType},
},
},
"id": {
Description: lang.MarkupContent{
Value: "id of the module",
Kind: lang.PlainTextKind,
},
Constraint: schema.LiteralType{Type: cty.DynamicPseudoType},
IsOptional: true,
OriginForTarget: &schema.PathTarget{
Address: schema.Address{schema.StaticStep{Name: "var"}, schema.AttrNameStep{}},
Path: lang.Path{Path: "./local", LanguageID: "terraform"},
Constraints: schema.Constraints{ScopeId: "variable", Type: cty.DynamicPseudoType},
},
},
}},
},
}

modPath := "./local"
Expand Down

0 comments on commit a5e0efe

Please sign in to comment.