Commit Graph

10 Commits

Author SHA1 Message Date
Martin Atkins
c9d9a966f9 getproviders: dep mapping support for OCI repositories
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-06-06 16:17:18 -07:00
Martin Atkins
d0936ab68f main: Support provider mappings in dependency mapping files
This is only basic stub support. The getproviders package doesn't yet know
how to do anything other than just return the main source, so it can't yet
be used to do anything useful. Hopefully it'll become more useful in
future commits.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-06-06 11:38:22 -07:00
Martin Atkins
65a0f7a656 registry+getproviders: Registry client policy centralized in main
The primary reason for this change is that registry.NewClient was
originally imposing its own decision about service discovery request
policy on every other user of the shared disco.Disco object by modifying
it directly.

We have been moving towards using a dependency inversion style where
package main is responsible for deciding how everything should be
configured based on global CLI arguments, environment variables, and the
CLI configuration, and so this commit moves to using that model for the
HTTP clients used by the module and provider registry client code.

This also makes explicit what was previously hidden away: that all service
discovery requests are made using the same HTTP client policy as for
requests to module registries, even if the service being discovered is not
a registry. This doesn't seem to have been the intention of the code as
previously written, but was still its ultimate effect: there is only one
disco.Disco object shared across all discovery callers and so changing its
configuration in any way changes it for everyone.

This initial rework is certainly not perfect: these components were not
originally designed to work in this way and there are lots of existing
test cases relying on them working the old way, and so this is a compromise
to get the behavior we now need (using consistent HTTP client settings
across all callers) without disrupting too much existing code.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-12 10:50:17 -07:00
Martin Atkins
0f0b928e98 main: Move the OCI Distribution-related helpers into their own file
These functions and types are about to become cross-cutting concerns shared
between both the provider and module installers in a future commit, so
we'll move them out to a separate file to hopefully communicate the
relationships between these parts a little more clearly.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-04-16 07:52:51 -07:00
Martin Atkins
6dab83e3bc cliconfig+main: Allow oci_mirror as a new provider installation method
It's now valid to include an oci_mirror block in the provider_installation
block in the CLI configuration, specifying that OpenTofu should try to
install providers from OCI repositories based on a template that maps
from OpenTofu-style provider source addresses into OCI repository
addresses.

The getproviders.Source implementation for this was added in a previous
commit, so this is mainly just wiring it up to the cliconfig layer and
the dependency wiring code in package main.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-03-26 09:52:07 -07:00
Martin Atkins
b1f5cb2588 main: stub of using OCI credentials from the cliconfig package
In a future commit we'll introduce a new provider source that can use an
OCI registry as a new kind of provider mirror, but this commit is just to
illustrate how we'd get the needed credentials settings to that point using
our typical dependency inversion style, ending in a TODO comment that we'll
resolve later.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-03-13 08:19:57 -07:00
Nathan Baulch
9b7bec31b4 Another batch of minor typos (#1953)
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2024-09-09 07:51:39 -04:00
namgyalangmo
cb2e9119aa Update copyright notice (#1232)
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
2024-02-08 09:48:59 +00:00
Mario Valderrama
e84b2f7f95 Support the XDG Base Directory Specification (#1200)
Signed-off-by: Mario Valderrama <mario.valderrama@ionos.com>
2024-01-31 11:04:09 +01:00
Elbaz
8465827f03 go build / go install should generate tofu binary (#590) 2023-09-27 15:37:55 +03:00