validate provider_meta contains no interpolations
The provider_meta specification does not allow interpolation, but we were not preventing it in the configuration.
This commit is contained in:
parent
b26ae9cf48
commit
759b76436a
|
@ -13,8 +13,20 @@ type ProviderMeta struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeProviderMetaBlock(block *hcl.Block) (*ProviderMeta, hcl.Diagnostics) {
|
func decodeProviderMetaBlock(block *hcl.Block) (*ProviderMeta, hcl.Diagnostics) {
|
||||||
|
// provider_meta must be a static map. We can verify this by attempting to
|
||||||
|
// evaluate the values.
|
||||||
|
attrs, diags := block.Body.JustAttributes()
|
||||||
|
if diags.HasErrors() {
|
||||||
|
return nil, diags
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, attr := range attrs {
|
||||||
|
_, d := attr.Expr.Value(nil)
|
||||||
|
diags = append(diags, d...)
|
||||||
|
}
|
||||||
|
|
||||||
// verify that the local name is already localized or produce an error.
|
// verify that the local name is already localized or produce an error.
|
||||||
diags := checkProviderNameNormalized(block.Labels[0], block.DefRange)
|
diags = append(diags, checkProviderNameNormalized(block.Labels[0], block.DefRange)...)
|
||||||
|
|
||||||
return &ProviderMeta{
|
return &ProviderMeta{
|
||||||
Provider: block.Labels[0],
|
Provider: block.Labels[0],
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
terraform {
|
||||||
|
provider_meta "my-provider" {
|
||||||
|
hello = var.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "name" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
terraform {
|
||||||
|
provider_meta "my-provider" {
|
||||||
|
hello = "test-module"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue