diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/flatmap/expand.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/flatmap/expand.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vendor/github.com/hashicorp/terraform/flatmap/expand.go b/vendor/github.com/hashicorp/terraform/flatmap/expand.go index e0b81b6..1449065 100644 --- a/vendor/github.com/hashicorp/terraform/flatmap/expand.go +++ b/vendor/github.com/hashicorp/terraform/flatmap/expand.go | |||
@@ -60,6 +60,11 @@ func expandArray(m map[string]string, prefix string) []interface{} { | |||
60 | return []interface{}{} | 60 | return []interface{}{} |
61 | } | 61 | } |
62 | 62 | ||
63 | // NOTE: "num" is not necessarily accurate, e.g. if a user tampers | ||
64 | // with state, so the following code should not crash when given a | ||
65 | // number of items more or less than what's given in num. The | ||
66 | // num key is mainly just a hint that this is a list or set. | ||
67 | |||
63 | // The Schema "Set" type stores its values in an array format, but | 68 | // The Schema "Set" type stores its values in an array format, but |
64 | // using numeric hash values instead of ordinal keys. Take the set | 69 | // using numeric hash values instead of ordinal keys. Take the set |
65 | // of keys regardless of value, and expand them in numeric order. | 70 | // of keys regardless of value, and expand them in numeric order. |
@@ -101,7 +106,7 @@ func expandArray(m map[string]string, prefix string) []interface{} { | |||
101 | } | 106 | } |
102 | sort.Ints(keysList) | 107 | sort.Ints(keysList) |
103 | 108 | ||
104 | result := make([]interface{}, num) | 109 | result := make([]interface{}, len(keysList)) |
105 | for i, key := range keysList { | 110 | for i, key := range keysList { |
106 | keyString := strconv.Itoa(key) | 111 | keyString := strconv.Itoa(key) |
107 | if computed[keyString] { | 112 | if computed[keyString] { |