Commit Graph

32747 Commits

Author SHA1 Message Date
Martin Atkins
e02159ee83 main: Log the effective set of OCI credential search locations
Previously we generated some logs during the discovery process indicating
which locations OpenTofu was probing for ambient credentials, but we didn't
explicitly report the overall result of the discovery process.

These new log lines will now report the final effective set of credential
configuration locations just before we try to use them in either the
provider installation or module installation codepaths. The strings
returned by CredentialsConfigLocationForUI are intended for just this sort
of feedback: the exact format varies for each kind of location, but it's
always a concise string identifying a location that OpenTofu will consider
when attempting to decide credentials.

Logging this here does unfortunately mean that the log output will be
repeated for each separate OCI registry request. There not being a great
single location to generate these logs was the main reason we didn't
include something like this in the first implementation, but the set of
config locations is small on any reasonable system and we've already had
a few folks struggle to understand why OpenTofu is making a certain
decision about credential sources so this is a pragmatic small step to give
us some extra diagnostic information in bug reports without affecting the
normal UI output for now.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-07-02 14:46:52 -04:00
James Humphries
57408eb898 Prep for 1.10.2 release (#2983)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
v1.10.2
2025-07-01 18:07:46 +01:00
Martin Atkins
9509c5c6e4 CHANGELOG: Entry for #2979 and some other miscellaneous tidying
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-07-01 09:49:19 -07:00
Martin Atkins
128a77a288 command: Only shim dependency lock file for installation actions
Recently we added a call to Locks.UpgradeFromPredecessorProject to try to
preserve dependency selections made for providers under
registry.terraform.io/hashicorp/* when switching to OpenTofu for the first
time.

However, this behavior did not properly cater for the situation where the
configuration intentionally specifies registry.terraform.io explicitly in
a source address: that would then cause OpenTofu to incorrectly try to make
a factory function for the shimmed provider version when working in
command.Meta.providerFactories, which would then fail because no such
provider appears in the cache directory.

Instead then, we'll limit the shimming only to installation-related actions
while only using the dependency locks exactly as written when preparing to
actually _run_ the provider plugins.

This is bothersome to test because our tests are not allowed to directly
access registry.terraform.io; the test case here mimicks one case in which
it could be valid for an OpenTofu user to explicitly use
registry.terraform.io: if they've used the CLI configuration to arrange for
that hostname to be handled only via a mirror rather than by direct access
to the origin registry. The terms of service for registry.terraform.io
currently prohibit using it for anything other than Terraform, so we ensure
that this test cannot make requests to any real services at that hostname.

Note that telling OpenTofu to use registry.terraform.io is not officially
supported and may cause other problems beyond what was addressed by this
PR, since OpenTofu tends to assume that this hostname would appear only
during the process of migrating from Terraform and might make unexpected
decisions based on that assumption. Despite us making this fix, those who
are explicitly specifying registry.terraform.io in their configuration
should make plans to stop doing that and to set things up some other way
instead.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-07-01 09:49:19 -07:00
Andrei Ciobanu
c6d2d32f42 Add changelog for 2970 (#2980)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: James Humphries <James@james-humphries.co.uk>
Co-authored-by: James Humphries <James@james-humphries.co.uk>
2025-07-01 09:31:05 -07:00
Andrei Ciobanu
731a6cb23e Adjust one of the tests to ensure that the customer managed sse is configured correctly for the request to get the lock file (#2978)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-06-30 11:56:09 -04:00
Andrei Ciobanu
74502c0d57 Unify encryption calls s3 backend (#2976)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-06-30 11:56:02 -04:00
Andrei Ciobanu
72eb3645b1 Add encryption headers for the s3 native locking file (#2975)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-06-30 11:55:53 -04:00
Martin Atkins
9353fa6efe website: OCI provider mirror build doesn't need --artifact-platform (#2964)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-06-30 07:33:26 -04:00
Christian Mesh
60f839aa4e Bump to v1.10.1
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
v1.10.1
2025-06-25 09:44:18 -04:00
Martin Atkins
35a8e123bc backend/s3: Use APNInfo instead of UserAgent (#2955)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-06-25 09:16:12 -04:00
Martin Atkins
755f1e1c65 [v1.10 BACKPORT] website: OCI provider mirror shouldn't talk about prereleases anymore (#2952)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-06-24 18:18:35 +01:00
Martin Atkins
504a50895f [v1.10 backport] go.mod: Upgrade to Go 1.24.4 (#2927)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-06-24 11:06:28 -04:00
Christian Mesh
1ffecd7f37 Bump version to v1.10.0!
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
v1.10.0
2025-06-24 08:54:00 -04:00
James Humphries
eb40bb4484 What's new fixes (#2950)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2025-06-24 08:44:03 -04:00
James Humphries
e08d17de5d Update small feedback changes to what's new (#2949)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2025-06-24 08:36:03 -04:00
James Humphries
303886ff65 Updated what's new, docker install guides, added OTel docs (#2942)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2025-06-24 08:11:35 -04:00
Martin Atkins
3dcb2c163f CHANGELOG: Copy-editing pass in preparation for v1.10.0 final
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-06-16 08:36:15 -07:00
Christian Mesh
ee08cc9b10 Bump version to 1.10.0-rc1
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
v1.10.0-rc1
2025-06-04 07:42:20 -04:00
Christian Mesh
6eb1375816 Bump version to v1.10-beta2
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
v1.10.0-beta2
2025-05-23 09:51:19 -04:00
Christian Mesh
176a3d1417 Remove m*n locking from resource evaluation and O(m * n * (m+n)) iteration (#2835)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-23 09:51:03 -04:00
James Humphries
701b997b62 Allow end-users to set OTEL_SERVICE_NAME (#2841)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-23 09:50:58 -04:00
Martin Atkins
f2dd13a9ab tofu: Plumb context.Context through the resource handling functions
The graph node types related to resources and resource instances use a
bunch of helper functions in different combinations, rather than calling
directly into the provider API.

This commit plumbs context.Context through to the functions that _do_
eventually call methods directly on the provider object, leaving us just
one more step away from plumbing the context through to the actual gRPC
calls. The next step (in a future commit) will be to update the
providers.Interface methods to take context.Context arguments and then
have the gRPC-based implementations of that interface pass the context
through to the gRPC client stub calls, and then we should be pretty close
to being able to turn on OTel tracing instrumentation for our gRPC
client requests.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-23 09:50:52 -04:00
Martin Atkins
c3ccab316e tofu: Rename EvalContext params to evalCtx in resource-related files
This continues our ongoing standardization on using evalCtx for parameters
of type EvalContext, so that we can use ctx for parameters of type
context.Context.

This commit is just a bunch of mechanical renames with no substantive
changes. Future commits will introduce additional context.Context params
to many of these functions.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-23 09:50:46 -04:00
James Humphries
80197640a1 Added otel tracing to show command (#2734)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-23 09:49:54 -04:00
Martin Atkins
6f0d3d3a07 Build with Go 1.24.3.
This minor release includes a security update that does not directly affect
OpenTofu, but we'll adopt the fix for future releases anyway since the
risk seems low and this will likely help quiet false positive reports from
security scanners moving forward.

This also includes various non-security bugfixes which may improve
OpenTofu's reliability.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-19 13:24:46 -07:00
Christian Mesh
566ab35b93 Remove Target Release PR template field (#2821)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-19 10:26:47 -04:00
Christian Mesh
d4ec388980 Bump version for 1.10.0-beta1 (#2822)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
v1.10.0-beta1
2025-05-19 13:45:45 +01:00
Martin Atkins
d1f0999aed command/views/json: Diagnostic context for single-symbol traversals (#2815)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-19 07:25:58 -04:00
Martin Atkins
99a0c6eb6f Automatically translate dependency lock file entries when switching from OpenTofu's predecessor (#2791)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-19 07:25:14 -04:00
Martin Atkins
e4fec9c6ca tfplugin5+tfplugin5: Adopt the latest protocol versions (#2817)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-19 07:00:49 -04:00
Christian Mesh
d130175ed1 Fix iteration issue in transform_destroy (#2809)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-19 07:00:34 -04:00
Martin Atkins
5ad92ad158 go.mod: go get github.com/zclconf/go-cty@v1.16.3 (#2816)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-19 07:00:17 -04:00
Martin Atkins
3be9841232 package main: Prevent disco.Disco generating OTel traces
The disco.Disco API isn't yet set up to pass through context.Context, and
so if we give it a HTTP client that has the OpenTelemetry instrumentation
on it then any HTTP request causes an orphan trace span disconnected from
the main trace, which causes annoying noise in some trace viewers.

As a temporary solution so we can ship v1.10 soon without making large
changes to the svchost library, we'll prevent the HTTP client constructor
function from detecting that tracing is enabled by passing it
context.TODO() instead of the actual context. This would not be acceptable
in the long run but is safe for this temporary workaround because currently
httpclient.New doesn't use the given context for anything except detecting
whether tracing is enabled.

We will address this in a more complete way during the v1.11 development
period by modernizing svchost to take context.Context arguments on all
functions that can potentially make external requests.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-16 09:12:28 -07:00
Patrick Decat
9ac06d3c8b docs: relocate sentence about .terraformignore to proper section (#2812)
Signed-off-by: Patrick Decat <pdecat@gmail.com>
2025-05-16 13:54:30 +03:00
Christian Mesh
6c14802e20 Allow nodeExpandCheck to influence node pruning (#2593)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
Co-authored-by: Diogenes Fernandes <diofeher@gmail.com>
2025-05-15 14:12:48 -04:00
Christian Mesh
d513bad8af Better error message when provider config is not found for iteration (#2806)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-15 12:07:30 -04:00
Christian Mesh
aaed9f83e4 Fix linting in internal/command (#2798)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-15 07:39:11 -04:00
Andrei Ciobanu
8396d0459c Add github workflow to run govoulncheck on all branches with supported OpenTofu versions (#2636)
Signed-off-by: yottta <andrei.ciobanu@opentofu.org>
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-05-14 18:26:22 +03:00
Andrei Ciobanu
2ef59e2299 Add note about the diff dependency on the fmt command (#2801)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-05-14 15:33:59 +03:00
Christian Mesh
24a13dd090 Fix potential loss of local state (#2799)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-14 06:43:36 -04: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
Christian Mesh
3334ed5e1c Fix lint issues in internal/communicator (#2779)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Co-authored-by: James Humphries <james@james-humphries.co.uk>
2025-05-12 13:39:43 -04:00
baa-ableton
85bfb19577 Fix #2584: Accept null value for version if module source is local (#2660)
Signed-off-by: Babur Ayanlar <babur.ayanlar@ableton.com>
Signed-off-by: baa-ableton <110462357+baa-ableton@users.noreply.github.com>
2025-05-12 09:33:53 -04:00
Christian Mesh
00db253a04 Fix lint issues in internal/configs (#2780)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-12 07:38:52 -04:00
Christian Mesh
ff7ba7a95f Fix lint issues in internal/tofu (#2790)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-12 07:28:35 -04:00
Christian Mesh
e84d9e10b7 Fix lint issues in internal/getproviders (#2784)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-09 14:09:36 -07:00
Christian Mesh
13c1ca768b Fix lint issues in ./internal/encryption (#2782)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-09 14:06:42 -07:00
Christian Mesh
240e3dc79b Fix lint issues in internal/genconfig (#2783)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-09 14:00:08 -07:00
Christian Mesh
dafd1798b7 Fix lint issues in internal/providercache (#2788)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-09 13:59:39 -07:00