configs: fix panic when the value is missing from version attribute in a provider block
This commit is contained in:
parent
a0f06826ab
commit
2a457115a3
|
@ -0,0 +1,3 @@
|
||||||
|
provider "template" {
|
||||||
|
version =
|
||||||
|
}
|
|
@ -45,6 +45,13 @@ func decodeVersionConstraint(attr *hcl.Attribute) (VersionConstraint, hcl.Diagno
|
||||||
return ret, diags
|
return ret, diags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !val.IsWhollyKnown() {
|
||||||
|
// If there is a syntax error, HCL sets the value of the given attribute
|
||||||
|
// to cty.DynamicVal. A diagnostic for the syntax error will already
|
||||||
|
// bubble up, so we will move forward gracefully here.
|
||||||
|
return ret, diags
|
||||||
|
}
|
||||||
|
|
||||||
constraintStr := val.AsString()
|
constraintStr := val.AsString()
|
||||||
constraints, err := version.NewConstraint(constraintStr)
|
constraints, err := version.NewConstraint(constraintStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue