configs: do not panic if module version is a variable (#20681)
Fixes #20653
This commit is contained in:
parent
87f1877a81
commit
2c60140cad
|
@ -0,0 +1,6 @@
|
||||||
|
variable "module_version" { default = "v1.0" }
|
||||||
|
|
||||||
|
module "foo" {
|
||||||
|
source = "./ff"
|
||||||
|
version = var.module_version
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue