]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/terraform/configs/configschema/internal_validate.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / configs / configschema / internal_validate.go
similarity index 83%
rename from vendor/github.com/hashicorp/terraform/config/configschema/internal_validate.go
rename to vendor/github.com/hashicorp/terraform/configs/configschema/internal_validate.go
index 33cbe884f1fd82f8cb65a0a7bde73124e5fb1774..ebf1abbab16cc88855d79f6edfbd2bdaa260076b 100644 (file)
@@ -72,10 +72,23 @@ func (b *Block) internalValidate(prefix string, err error) error {
                        case blockS.MinItems < 0 || blockS.MinItems > 1:
                                err = multierror.Append(err, fmt.Errorf("%s%s: MinItems and MaxItems must be set to either 0 or 1 in NestingSingle mode", prefix, name))
                        }
+               case NestingGroup:
+                       if blockS.MinItems != 0 || blockS.MaxItems != 0 {
+                               err = multierror.Append(err, fmt.Errorf("%s%s: MinItems and MaxItems cannot be used in NestingGroup mode", prefix, name))
+                       }
                case NestingList, NestingSet:
                        if blockS.MinItems > blockS.MaxItems && blockS.MaxItems != 0 {
                                err = multierror.Append(err, fmt.Errorf("%s%s: MinItems must be less than or equal to MaxItems in %s mode", prefix, name, blockS.Nesting))
                        }
+                       if blockS.Nesting == NestingSet {
+                               ety := blockS.Block.ImpliedType()
+                               if ety.HasDynamicTypes() {
+                                       // This is not permitted because the HCL (cty) set implementation
+                                       // needs to know the exact type of set elements in order to
+                                       // properly hash them, and so can't support mixed types.
+                                       err = multierror.Append(err, fmt.Errorf("%s%s: NestingSet blocks may not contain attributes of cty.DynamicPseudoType", prefix, name))
+                               }
+                       }
                case NestingMap:
                        if blockS.MinItems != 0 || blockS.MaxItems != 0 {
                                err = multierror.Append(err, fmt.Errorf("%s%s: MinItems and MaxItems must both be 0 in NestingMap mode", prefix, name))