]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/hil/convert.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / hil / convert.go
index f2024d01c28abe263d816f331471b919edc4ec07..184e029b05ed3914ab112c57a4232e964c1cc215 100644 (file)
@@ -47,8 +47,23 @@ func hilMapstructureWeakDecode(m interface{}, rawVal interface{}) error {
 }
 
 func InterfaceToVariable(input interface{}) (ast.Variable, error) {
-       if inputVariable, ok := input.(ast.Variable); ok {
-               return inputVariable, nil
+       if iv, ok := input.(ast.Variable); ok {
+               return iv, nil
+       }
+
+       // This is just to maintain backward compatibility
+       // after https://github.com/mitchellh/mapstructure/pull/98
+       if v, ok := input.([]ast.Variable); ok {
+               return ast.Variable{
+                       Type:  ast.TypeList,
+                       Value: v,
+               }, nil
+       }
+       if v, ok := input.(map[string]ast.Variable); ok {
+               return ast.Variable{
+                       Type:  ast.TypeMap,
+                       Value: v,
+               }, nil
        }
 
        var stringVal string