Documentation
¶
Overview ¶
Package mirror implements eager, multi-platform pre-seeding of the Terraform registry cache. It is the eager counterpart to the lazy proxy in pkg/terraform/cache: where the proxy populates the cache on demand for the host platform during a normal `init`, the mirror uses `terraform/tofu providers mirror` to pre-fetch a component's required providers for every configured platform into the same canonical filesystem_mirror layout. The shared directory then serves three ways: lazily (proxy), eagerly (mirror), and offline (filesystem_mirror) — the foundation for air-gapped reproducible builds.
Mirroring providers has no inter-component dependencies, so multi-component runs (--all/--components/--query) iterate the selected components in no particular order, unlike the dependency-ordered plan/apply scheduler.
Package mirror's TUI renders a package-manager-style progress view for provider mirroring (spinner + per-provider×platform checkmark lines), matching the look of `atmos vendor pull` (internal/exec/vendor_model.go). Progress is driven by parsing the `terraform/tofu providers mirror` output stream so each provider/platform that finishes downloading scrolls past as its own line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolvePlatforms ¶
ResolvePlatforms applies the platform precedence: the CLI flag wins, then the configured components.terraform.platforms, then the current host platform (<os>_<arch>).
Types ¶
type CacheStats ¶
type CacheStats struct {
Objects int `json:"objects" yaml:"objects"`
Providers int `json:"providers" yaml:"providers"`
Modules int `json:"modules" yaml:"modules"`
TotalSizeBytes int64 `json:"total_size_bytes" yaml:"total_size_bytes"`
TotalSize string `json:"total_size" yaml:"total_size"`
}
CacheStats is the on-disk cache summary included in the result.
type Options ¶
type Options struct {
// Component is the single Atmos component to mirror. Empty when a multi-component
// selector (All/Components/Query) or a bare stack is used.
Component string
// Stack is the Atmos stack. Required for a single component; an optional scope for
// the multi-component selectors.
Stack string
// PlatformsFlag is the optional CLI override for target platforms. When empty,
// the configured platforms (else the host platform) are used.
PlatformsFlag []string
// All mirrors every component in every stack (or in Stack, when set).
All bool
// Components filters the mirror to specific components.
Components []string
// Query filters the mirror with a YQ expression.
Query string
// Format selects the output: "" (human) streams the mirror progress and prints a
// summary; "json"/"yaml" suppress the progress and emit a structured result.
Format string
}
Options configures a mirror run. Targeting mirrors the multi-component flags of `atmos terraform plan`: a single component, --all, --components, or --query, with an optional --stack scope.
type Result ¶
type Result struct {
Components []Target `json:"components" yaml:"components"`
Platforms []string `json:"platforms" yaml:"platforms"`
Cache CacheStats `json:"cache" yaml:"cache"`
}
Result is the structured outcome of a mirror run, for --format json|yaml.