diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/configs/configschema/coerce_value.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/configs/configschema/coerce_value.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/coerce_value.go b/vendor/github.com/hashicorp/terraform/configs/configschema/coerce_value.go index e59f58d..7996c38 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configschema/coerce_value.go +++ b/vendor/github.com/hashicorp/terraform/configs/configschema/coerce_value.go | |||
@@ -113,7 +113,10 @@ func (b *Block) coerceValue(in cty.Value, path cty.Path) (cty.Value, error) { | |||
113 | return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("must be a list") | 113 | return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("must be a list") |
114 | } | 114 | } |
115 | l := coll.LengthInt() | 115 | l := coll.LengthInt() |
116 | if l < blockS.MinItems { | 116 | |
117 | // Assume that if there are unknowns this could have come from | ||
118 | // a dynamic block, and we can't validate MinItems yet. | ||
119 | if l < blockS.MinItems && coll.IsWhollyKnown() { | ||
117 | return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("insufficient items for attribute %q; must have at least %d", typeName, blockS.MinItems) | 120 | return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("insufficient items for attribute %q; must have at least %d", typeName, blockS.MinItems) |
118 | } | 121 | } |
119 | if l > blockS.MaxItems && blockS.MaxItems > 0 { | 122 | if l > blockS.MaxItems && blockS.MaxItems > 0 { |
@@ -161,7 +164,10 @@ func (b *Block) coerceValue(in cty.Value, path cty.Path) (cty.Value, error) { | |||
161 | return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("must be a set") | 164 | return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("must be a set") |
162 | } | 165 | } |
163 | l := coll.LengthInt() | 166 | l := coll.LengthInt() |
164 | if l < blockS.MinItems { | 167 | |
168 | // Assume that if there are unknowns this could have come from | ||
169 | // a dynamic block, and we can't validate MinItems yet. | ||
170 | if l < blockS.MinItems && coll.IsWhollyKnown() { | ||
165 | return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("insufficient items for attribute %q; must have at least %d", typeName, blockS.MinItems) | 171 | return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("insufficient items for attribute %q; must have at least %d", typeName, blockS.MinItems) |
166 | } | 172 | } |
167 | if l > blockS.MaxItems && blockS.MaxItems > 0 { | 173 | if l > blockS.MaxItems && blockS.MaxItems > 0 { |