aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/config/loader_hcl.go
diff options
context:
space:
mode:
authorRadek Simko <radek.simko@gmail.com>2017-08-10 14:38:14 +0200
committerRadek Simko <radek.simko@gmail.com>2017-08-10 14:38:14 +0200
commitc680a8e1622ed0f18751d9d167c836ee24f5e897 (patch)
tree864f925049d422033dd25a73bafce32b361c8827 /vendor/github.com/hashicorp/terraform/config/loader_hcl.go
parent38f8880ac81bfabc6d7f82e4dc89661f20fc559e (diff)
downloadterraform-provider-statuscake-c680a8e1622ed0f18751d9d167c836ee24f5e897.tar.gz
terraform-provider-statuscake-c680a8e1622ed0f18751d9d167c836ee24f5e897.tar.zst
terraform-provider-statuscake-c680a8e1622ed0f18751d9d167c836ee24f5e897.zip
vendor: github.com/hashicorp/terraform/...@v0.10.0
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/config/loader_hcl.go')
-rw-r--r--vendor/github.com/hashicorp/terraform/config/loader_hcl.go28
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
20var ReservedResourceFields = []string{
21 "connection",
22 "count",
23 "depends_on",
24 "lifecycle",
25 "provider",
26 "provisioner",
27}
28
29var ReservedProviderFields = []string{
30 "alias",
31 "version",
32}
33
20func (t *hclConfigurable) Config() (*Config, error) { 34func (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 }