X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fgithub.com%2Fhashicorp%2Fterraform%2Fhelper%2Fschema%2Fprovider.go;h=fb28b4151d4fae65c261b0ee7227889bcb0c2d50;hb=07971ca38143c5faf951d152fba370ddcbe26ad5;hp=d52d2f5f06362ac0bfdd56f1648c56cd63f69ffd;hpb=21252084ae8c5f3321b45008fd5a6b162b293407;p=github%2Ffretlink%2Fterraform-provider-statuscake.git diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/provider.go b/vendor/github.com/hashicorp/terraform/helper/schema/provider.go index d52d2f5..fb28b41 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/provider.go +++ b/vendor/github.com/hashicorp/terraform/helper/schema/provider.go @@ -8,6 +8,7 @@ import ( "sync" "github.com/hashicorp/go-multierror" + "github.com/hashicorp/terraform/config" "github.com/hashicorp/terraform/terraform" ) @@ -89,6 +90,13 @@ func (p *Provider) InternalValidate() error { validationErrors = multierror.Append(validationErrors, err) } + // Provider-specific checks + for k, _ := range sm { + if isReservedProviderFieldName(k) { + return fmt.Errorf("%s is a reserved field name for a provider", k) + } + } + for k, r := range p.ResourcesMap { if err := r.InternalValidate(nil, true); err != nil { validationErrors = multierror.Append(validationErrors, fmt.Errorf("resource %s: %s", k, err)) @@ -104,6 +112,15 @@ func (p *Provider) InternalValidate() error { return validationErrors } +func isReservedProviderFieldName(name string) bool { + for _, reservedName := range config.ReservedProviderFields { + if name == reservedName { + return true + } + } + return false +} + // Meta returns the metadata associated with this provider that was // returned by the Configure call. It will be nil until Configure is called. func (p *Provider) Meta() interface{} {