diff --git a/config/config.go b/config/config.go index 7c68f6cec..cab5f728a 100644 --- a/config/config.go +++ b/config/config.go @@ -213,8 +213,8 @@ func (c *Config) Validate() error { // are valid in the Validate step. func (c *Config) allVariables() map[string][]InterpolatedVariable { result := make(map[string][]InterpolatedVariable) - for n, pc := range c.ProviderConfigs { - source := fmt.Sprintf("provider config '%s'", n) + for _, pc := range c.ProviderConfigs { + source := fmt.Sprintf("provider config '%s'", pc.Name) for _, v := range pc.RawConfig.Variables { result[source] = append(result[source], v) } diff --git a/config/test-fixtures/validate-good/main.tf b/config/test-fixtures/validate-good/main.tf index 7cd229611..965877a10 100644 --- a/config/test-fixtures/validate-good/main.tf +++ b/config/test-fixtures/validate-good/main.tf @@ -3,6 +3,12 @@ variable "foo" { description = "bar"; } +variable "amis" { + default = { + "east": "foo", + } +} + provider "aws" { access_key = "foo"; secret_key = "bar"; @@ -16,7 +22,7 @@ resource "aws_security_group" "firewall" { } resource aws_instance "web" { - ami = "${var.foo}" + ami = "${var.amis.east}" security_groups = [ "foo", "${aws_security_group.firewall.foo}"