diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/helper/schema/schema.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/helper/schema/schema.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/schema.go b/vendor/github.com/hashicorp/terraform/helper/schema/schema.go index 632672a..acb5618 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/schema.go +++ b/vendor/github.com/hashicorp/terraform/helper/schema/schema.go | |||
@@ -15,6 +15,7 @@ import ( | |||
15 | "fmt" | 15 | "fmt" |
16 | "os" | 16 | "os" |
17 | "reflect" | 17 | "reflect" |
18 | "regexp" | ||
18 | "sort" | 19 | "sort" |
19 | "strconv" | 20 | "strconv" |
20 | "strings" | 21 | "strings" |
@@ -661,7 +662,13 @@ func (m schemaMap) InternalValidate(topSchemaMap schemaMap) error { | |||
661 | if v.ValidateFunc != nil { | 662 | if v.ValidateFunc != nil { |
662 | switch v.Type { | 663 | switch v.Type { |
663 | case TypeList, TypeSet: | 664 | case TypeList, TypeSet: |
664 | return fmt.Errorf("ValidateFunc is not yet supported on lists or sets.") | 665 | return fmt.Errorf("%s: ValidateFunc is not yet supported on lists or sets.", k) |
666 | } | ||
667 | } | ||
668 | |||
669 | if v.Deprecated == "" && v.Removed == "" { | ||
670 | if !isValidFieldName(k) { | ||
671 | return fmt.Errorf("%s: Field name may only contain lowercase alphanumeric characters & underscores.", k) | ||
665 | } | 672 | } |
666 | } | 673 | } |
667 | } | 674 | } |
@@ -669,6 +676,11 @@ func (m schemaMap) InternalValidate(topSchemaMap schemaMap) error { | |||
669 | return nil | 676 | return nil |
670 | } | 677 | } |
671 | 678 | ||
679 | func isValidFieldName(name string) bool { | ||
680 | re := regexp.MustCompile("^[a-z0-9_]+$") | ||
681 | return re.MatchString(name) | ||
682 | } | ||
683 | |||
672 | func (m schemaMap) diff( | 684 | func (m schemaMap) diff( |
673 | k string, | 685 | k string, |
674 | schema *Schema, | 686 | schema *Schema, |