From c680a8e1622ed0f18751d9d167c836ee24f5e897 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Thu, 10 Aug 2017 14:38:14 +0200 Subject: vendor: github.com/hashicorp/terraform/...@v0.10.0 --- vendor/github.com/hashicorp/terraform/flatmap/expand.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'vendor/github.com/hashicorp/terraform/flatmap') 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{} { return []interface{}{} } + // NOTE: "num" is not necessarily accurate, e.g. if a user tampers + // with state, so the following code should not crash when given a + // number of items more or less than what's given in num. The + // num key is mainly just a hint that this is a list or set. + // The Schema "Set" type stores its values in an array format, but // using numeric hash values instead of ordinal keys. Take the set // of keys regardless of value, and expand them in numeric order. @@ -101,7 +106,7 @@ func expandArray(m map[string]string, prefix string) []interface{} { } sort.Ints(keysList) - result := make([]interface{}, num) + result := make([]interface{}, len(keysList)) for i, key := range keysList { keyString := strconv.Itoa(key) if computed[keyString] { -- cgit v1.2.3