configs: fix panic when the value is missing from version attribute in a provider block

pull/21863/head
Kristin Laemmert 7 years ago committed by GitHub
parent a0f06826ab
commit 2a457115a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
provider "template" {
version =
}

@ -45,6 +45,13 @@ func decodeVersionConstraint(attr *hcl.Attribute) (VersionConstraint, hcl.Diagno
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()
constraints, err := version.NewConstraint(constraintStr)
if err != nil {

Loading…
Cancel
Save