Documentation
¶
Overview ¶
Package registry implements Terraform provider and module registry mirrors as adapters for the generic caching proxy (pkg/http/proxy). The provider mirror translates the Provider Network Mirror Protocol (what Terraform speaks to the proxy) into the upstream Provider Registry Protocol; the module mirror caches the module registry protocol and routes every module download — git:: sources included — back through the proxy, resolving the source with go-getter and caching it as a single servable tar artifact.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidModulePath = errors.New("invalid module mirror request path")
ErrInvalidModulePath indicates a module mirror request path that does not match the module registry protocol shape.
var ErrInvalidPlatform = errors.New("invalid provider platform")
ErrInvalidPlatform indicates a platform string that is not of the form os_arch.
var ErrInvalidProviderPath = errors.New("invalid provider mirror request path")
ErrInvalidProviderPath indicates a provider mirror request path that does not match the network-mirror protocol shape.
var ErrInvalidProviderSource = errors.New("invalid provider source address")
ErrInvalidProviderSource indicates a provider source address that is not of the form host/namespace/type.
var ErrModuleSourceFetch = errors.New("module source fetch failed")
ErrModuleSourceFetch indicates a module source could not be resolved and packed.
var ErrUpstreamStatus = errors.New("upstream registry returned non-success status")
ErrUpstreamStatus indicates a non-2xx response from an upstream registry call.
Functions ¶
This section is empty.
Types ¶
type ModuleMirror ¶
type ModuleMirror struct {
// contains filtered or unexported fields
}
ModuleMirror implements proxy.Mirror for the module registry protocol. It caches version listings and download resolutions, and routes every module download back through the proxy: the source is resolved with go-getter and cached as a single tar artifact, so git:: sources (the common case for the public registry and mono-repos) are cached just like HTTP archives.
func NewModuleMirror ¶
func NewModuleMirror(resolver SourceResolver) *ModuleMirror
NewModuleMirror constructs a module mirror that resolves module sources via resolver.
type Platform ¶
Platform is a Terraform provider target platform (operating system + CPU architecture), e.g. {OS: "linux", Arch: "amd64"}.
func HostPlatform ¶
func HostPlatform() Platform
HostPlatform returns the platform Atmos is currently running on.
func ParsePlatform ¶
ParsePlatform parses a Terraform os_arch platform token (e.g. "linux_amd64").
type ProviderMirror ¶
type ProviderMirror struct {
// contains filtered or unexported fields
}
ProviderMirror implements proxy.Mirror for the Provider Network Mirror Protocol, translating it into the upstream Provider Registry Protocol.
func NewProviderMirror ¶
func NewProviderMirror(client proxy.Doer) *ProviderMirror
NewProviderMirror constructs a provider mirror that uses client for upstream pre-flight calls (discovery, download resolution).
func (*ProviderMirror) DownloadInto ¶
func (m *ProviderMirror) DownloadInto(ctx context.Context, store proxy.Store, ref ProviderRef, platform Platform) (proxy.Meta, bool, error)
DownloadInto resolves a provider version's download for a single platform and stores the zip in the canonical filesystem_mirror layout under the store root, verifying the registry-provided zh: hash. It returns the object metadata and whether the object was already cached (in which case nothing is downloaded).
Unlike the proxy's request-driven Route path, DownloadInto is callable directly so commands (e.g. `atmos terraform cache warm`) can eagerly hydrate the cache — including for platforms other than the host's — without running Terraform.
type ProviderRef ¶
ProviderRef identifies a single provider version to mirror: a registry host, namespace, type, and exact version.
func ParseSource ¶
func ParseSource(source, version string) (ProviderRef, error)
ParseSource builds a ProviderRef from a fully-qualified source address (host/namespace/type, as recorded in .terraform.lock.hcl) and an exact version.
func (ProviderRef) Source ¶
func (r ProviderRef) Source() string
Source renders the host/namespace/type source address (without version).
type SourceResolver ¶
SourceResolver resolves a go-getter source string (e.g. "git::https://github.com/org/repo.git?ref=v1") into destDir, populating it with the module's working tree. The production implementation wraps pkg/downloader's go-getter client (with its insteadOf/credential-broker plumbing); tests inject a fake so no network is touched.