// ErrHostNoProviders is an error type used to indicate that a hostname given
// in a provider address does not support the provider registry protocol.
typeErrHostNoProvidersstruct{
Hostnamesvchost.Hostname
// HasOtherVersionis set to true if the discovery process detected
// declarations of services named "providers" whose version numbers did not
// match any version supported by the current version of Terraform.
//
// If this is set, it's helpful to hint to the user in an error message
// that the provider host may be expecting an older or a newer version
// of Terraform, rather than that it isn't a provider registry host at all.
HasOtherVersionbool
}
func(errErrHostNoProviders)Error()string{
switch{
caseerr.HasOtherVersion:
returnfmt.Sprintf("host %s does not support the provider registry protocol required by this Terraform version, but may be compatible with a different Terraform version",err.Hostname.ForDisplay())
default:
returnfmt.Sprintf("host %s does not offer a Terraform provider registry",err.Hostname.ForDisplay())
}
}
// ErrHostUnreachable is an error type used to indicate that a hostname
// given in a provider address did not resolve in DNS, did not respond to an
// HTTPS request for service discovery, or otherwise failed to correctly speak
// the service discovery protocol.
typeErrHostUnreachablestruct{
Hostnamesvchost.Hostname
Wrappederror
}
func(errErrHostUnreachable)Error()string{
returnfmt.Sprintf("could not connect to %s: %s",err.Hostname.ForDisplay(),err.Wrapped.Error())
}
// Unwrap returns the underlying error that occurred when trying to reach the
// indicated host.
func(errErrHostUnreachable)Unwrap()error{
returnerr.Wrapped
}
// ErrUnauthorized is an error type used to indicate that a hostname
// given in a provider address returned a "401 Unauthorized" or "403 Forbidden"
// error response when we tried to access it.
typeErrUnauthorizedstruct{
Hostnamesvchost.Hostname
// HaveCredentials is true when the request that failed included some
// credentials, and thus it seems that those credentials were invalid.
// Conversely, HaveCredentials is false if the request did not include
// credentials at all, in which case it seems that credentials must be
// provided.
HaveCredentialsbool
}
func(errErrUnauthorized)Error()string{
switch{
caseerr.HaveCredentials:
returnfmt.Sprintf("host %s rejected the given authentication credentials",err.Hostname)