configs: Fix crasher in provider configuration reference parsing

Due to a logic error, this would panic if given an empty traversal.
This commit is contained in:
Martin Atkins 2018-05-04 19:25:16 -07:00
parent cd584309b9
commit c4fac74371
1 changed files with 1 additions and 1 deletions

View File

@ -341,7 +341,7 @@ func decodeProviderConfigRef(expr hcl.Expression, argName string) (*ProviderConf
diags = append(diags, travDiags...) diags = append(diags, travDiags...)
} }
if len(traversal) < 1 && len(traversal) > 2 { if len(traversal) < 1 || len(traversal) > 2 {
// A provider reference was given as a string literal in the legacy // A provider reference was given as a string literal in the legacy
// configuration language and there are lots of examples out there // configuration language and there are lots of examples out there
// showing that usage, so we'll sniff for that situation here and // showing that usage, so we'll sniff for that situation here and