Merge pull request #25408 from hashicorp/alisdair/fix-panic-provider-alias

configs: Fail early for invalid resource provider
This commit is contained in:
Alisdair McDiarmid 2020-06-26 09:59:46 -04:00 committed by GitHub
commit 7190ef571e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -422,6 +422,9 @@ func decodeProviderConfigRef(expr hcl.Expression, argName string) (*ProviderConf
name := traversal.RootName() name := traversal.RootName()
nameDiags := checkProviderNameNormalized(name, traversal[0].SourceRange()) nameDiags := checkProviderNameNormalized(name, traversal[0].SourceRange())
diags = append(diags, nameDiags...) diags = append(diags, nameDiags...)
if diags.HasErrors() {
return nil, diags
}
ret := &ProviderConfigRef{ ret := &ProviderConfigRef{
Name: name, Name: name,

View File

@ -0,0 +1,3 @@
data "test_resource" "t" {
provider = my_test
}

View File

@ -0,0 +1,3 @@
resource "test_resource" "t" {
provider = my_test
}