mirror of
https://github.com/opentofu/registry-address
synced 2026-04-05 19:10:57 +00:00
No description
- Go 100%
|
|
||
|---|---|---|
| .github | ||
| .copywrite.hcl | ||
| .go-version | ||
| errors.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| module.go | ||
| module_package.go | ||
| module_test.go | ||
| provider.go | ||
| provider_test.go | ||
| README.md | ||
OpenTofu Registry Addresses
This Go library contains types to represent module and provider registry addresses as used in OpenTofu, along with the canonical implementations of parsing and comparing those addresses.
Provider addresses can be found in
tofu show -json <FILE>(full_name)tofu version -json(provider_selections)tofu providers schema -json(keys ofprovider_schemas)- within
required_providersblock in OpenTofu modules - OpenTofu CLI configuration file
- Plugin reattach configurations
Module addresses can be found within source argument
of module blocks in OpenTofu modules (*.tf)
and parts of the address (namespace and name) in the Module Registry API.
Compatibility
The module aims for compatibility with OpenTofu v1.5 and later.
Usage
Provider
pAddr, err := regaddr.ParseProviderSource("foo/bar")
if err != nil {
// deal with error
}
// pAddr == regaddr.Provider{
// Type: "foo",
// Namespace: "bar",
// Hostname: regaddr.DefaultProviderRegistryHost,
// }
Module
mAddr, err := regaddr.ParseModuleSource("foo/bar/baz//modules/example")
if err != nil {
// deal with error
}
// mAddr == Module{
// Package: ModulePackage{
// Host: regaddr.DefaultModuleRegistryHost,
// Namespace: "foo",
// Name: "bar",
// TargetSystem: "baz",
// },
// Subdir: "modules/example",
// },
Other Module Address Formats
OpenTofu supports various other module source address types that are not handled by this library. This library focuses only on the syntax used for OpenTofu module registries.