diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/config/loader_hcl.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/config/loader_hcl.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/config/loader_hcl.go b/vendor/github.com/hashicorp/terraform/config/loader_hcl.go index 9abb196..e85e493 100644 --- a/vendor/github.com/hashicorp/terraform/config/loader_hcl.go +++ b/vendor/github.com/hashicorp/terraform/config/loader_hcl.go | |||
@@ -17,6 +17,20 @@ type hclConfigurable struct { | |||
17 | Root *ast.File | 17 | Root *ast.File |
18 | } | 18 | } |
19 | 19 | ||
20 | var ReservedResourceFields = []string{ | ||
21 | "connection", | ||
22 | "count", | ||
23 | "depends_on", | ||
24 | "lifecycle", | ||
25 | "provider", | ||
26 | "provisioner", | ||
27 | } | ||
28 | |||
29 | var ReservedProviderFields = []string{ | ||
30 | "alias", | ||
31 | "version", | ||
32 | } | ||
33 | |||
20 | func (t *hclConfigurable) Config() (*Config, error) { | 34 | func (t *hclConfigurable) Config() (*Config, error) { |
21 | validKeys := map[string]struct{}{ | 35 | validKeys := map[string]struct{}{ |
22 | "atlas": struct{}{}, | 36 | "atlas": struct{}{}, |
@@ -562,6 +576,7 @@ func loadProvidersHcl(list *ast.ObjectList) ([]*ProviderConfig, error) { | |||
562 | } | 576 | } |
563 | 577 | ||
564 | delete(config, "alias") | 578 | delete(config, "alias") |
579 | delete(config, "version") | ||
565 | 580 | ||
566 | rawConfig, err := NewRawConfig(config) | 581 | rawConfig, err := NewRawConfig(config) |
567 | if err != nil { | 582 | if err != nil { |
@@ -583,9 +598,22 @@ func loadProvidersHcl(list *ast.ObjectList) ([]*ProviderConfig, error) { | |||
583 | } | 598 | } |
584 | } | 599 | } |
585 | 600 | ||
601 | // If we have a version field then extract it | ||
602 | var version string | ||
603 | if a := listVal.Filter("version"); len(a.Items) > 0 { | ||
604 | err := hcl.DecodeObject(&version, a.Items[0].Val) | ||
605 | if err != nil { | ||
606 | return nil, fmt.Errorf( | ||
607 | "Error reading version for provider[%s]: %s", | ||
608 | n, | ||
609 | err) | ||
610 | } | ||
611 | } | ||
612 | |||
586 | result = append(result, &ProviderConfig{ | 613 | result = append(result, &ProviderConfig{ |
587 | Name: n, | 614 | Name: n, |
588 | Alias: alias, | 615 | Alias: alias, |
616 | Version: version, | ||
589 | RawConfig: rawConfig, | 617 | RawConfig: rawConfig, |
590 | }) | 618 | }) |
591 | } | 619 | } |