configs: do not panic if module version is a variable (#20681)

Fixes #20653
This commit is contained in:
Kristin Laemmert 2019-03-14 09:12:27 -07:00 committed by GitHub
parent 87f1877a81
commit 2c60140cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,6 @@
variable "module_version" { default = "v1.0" }
module "foo" {
source = "./ff"
version = var.module_version
}

View File

@ -24,6 +24,9 @@ func decodeVersionConstraint(attr *hcl.Attribute) (VersionConstraint, hcl.Diagno
} }
val, diags := attr.Expr.Value(nil) val, diags := attr.Expr.Value(nil)
if diags.HasErrors() {
return ret, diags
}
var err error var err error
val, err = convert.Convert(val, cty.String) val, err = convert.Convert(val, cty.String)
if err != nil { if err != nil {