Commit Graph

33275 Commits

Author SHA1 Message Date
Andrei Ciobanu
4eaa76c435 Add notes on the backend flags initialisation for future refactor
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-26 17:28:55 +02:00
Andrei Ciobanu
dc7ff7ed9a Extract RemoteVersionCheck from Meta
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-26 15:17:06 +02:00
Andrei Ciobanu
032aa174bf This is a working state for the binary. Tests still broken
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-26 14:56:13 +02:00
Andrei Ciobanu
fec5baa07c TMP
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-23 17:12:29 +02:00
Andrei Ciobanu
0698931020 Update the meta backend section
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-28 12:11:26 +02:00
Andrei Ciobanu
a1525a7c1a Start the section about the meta backend
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-23 16:52:54 +02:00
Andrei Ciobanu
329e805bae Rework the RFC to present a more generic approach and mostly state the
needs and requirements that we should take care during such a refactor

Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-12-08 16:52:00 +02:00
Andrei Ciobanu
a209260e80 Initial proposal
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-11-05 16:52:19 +02:00
Andrei Ciobanu
d24b85fc68 Typo fix in the pg backend. Fix for #3700 (#3704)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-27 13:22:40 +02:00
Andrei Ciobanu
8e808f3cc2 Make it clear for the external key providers when it needs to generate decryption key (#3672)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-27 12:20:23 +02:00
Andrei Ciobanu
c7f46c713a Enhance the documentation and the integration tests for the pg backend (#3700)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-27 10:17:07 +02:00
Andrei Ciobanu
d088667ed7 Fix a hard to catch race condition in providers installation process (#3702)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-23 15:34:25 +02:00
James Humphries
c4f49afc10 Use explicit NoKey check instead of assuming nil in v3 upgrade (#3696)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2026-01-20 14:25:40 -05:00
Christian Mesh
6280691025 Support dual output streams in most commands (#3606)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Diógenes Fernandes <diofeher@gmail.com>
2026-01-20 14:08:10 -05:00
Diógenes Fernandes
0a631be1d6 Provider validation for enabled at module calls (#3680)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2026-01-20 13:06:22 -03:00
Martin Atkins
9ddd3c1128 Remove last remnants of ".go-version" file
Before Go 1.21 we relied on third-party and custom tooling to manage which
version of Go we were using for development, testing, and release builds.

However, modern Go toolchains have built-in support for selecting an
appropriate toolchain based on metadata in the go.mod file, and so we had
previously removed most uses of the .go-version file and were maintaining
it just as a remnant of the old state of things.

This replaces our last remaining use of the ".go-version" file with a small
tool that extracts the Go version from the go.mod file, and then removes
the ".go-version" file completely. The "go" and "toolchain" directives in
go.mod are now our single source of truth about which version of Go we're
currently using for OpenTofu.

(It may be possible to rework the Dockerfile for the consul backend to
handle Go version selection in a different way so that we'd no longer need
even this "selected-go-version" tool, but that's beyond the scope of this
commit which aims to leave it unmodified to make sure the effective testing
behavior for that backend is unchanged for now.)

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-20 07:50:18 -05:00
Denis O
9dbb5fcb9c Error checking simplifications (#3694)
Signed-off-by: Denis O <denis.o@linux.com>
2026-01-20 09:27:14 +00:00
Martin Atkins
f5d5cdf166 go.mod: Upgrade to Go 1.25.6
This minor revision includes a fix of a problem where a crafted zip file
can cause denial of service by taking a very long time to open the first
file in the archive, which can potentially be triggered by a
maliciously-crafted provider or module distribution archive fetched during
"tofu init".

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-19 08:41:51 -08:00
yy
4a86a1233c fix: typos in comments (#3691)
Signed-off-by: Yohei Yamamoto <yhymmt123@gmail.com>
2026-01-19 13:46:12 +00:00
Martin Atkins
2e09323694 engine/applying: First somewhat-working implementation
This is just enough to connect all of the apply engine parts together into
a functional whole which can at least attempt to apply a plan. There are
various gaps here that make this not fully work in practice, but the goal
of this commit is to just get all of the components connected together in
their current form and then subsequent commits will gradually build on this
to make it work better.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
4641cb8b2f engine/applying: Execution graph compilation and other stubbing
This is just some initial sketching of how the applying package might do
its work. Not yet finished, and I'm expecting to change about the
execution graph operations in future commits now that the main plan/apply
flow is plumbed in and so it's easier to test things end-to-end.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
d8d21619a4 backend/local: Initial setup for the new runtime's "apply" command
This is just enough to get the plan object and check that it has the
execution graph field populated, and to load the configuration. More to
come in later commits.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
f4d4a21925 command: Enable experimental runtime in BackendForLocalPlan
We previously added a check like this to the Meta.Backend method, but we
use Meta.BackendForLocalPlan instead when we're applying a saved plan, so
we need to make sure the setting gets propagated here too or else the
experimental codepath cannot be entered by the "tofu apply" command.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
6cb6952fce engine/planning: Track dependencies between resource instances
This makes explicit the relationships between resource instances so that
they'll be honored automatically when we actually execute the graph.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
4e07f8949c lang/eval: Populate DesiredResourceInstance.RequiredResourceInstances
The dependencies of a resource instance are based primarily on the marks
in the configuration value, and so we'll decide them as part of the same
function that decides the configuration value.

We then need to propagate that result through all of the intermediate
layers to the code that actually constructs the DesiredResourceInstance
object, at which point it's then available to the planning engine. In a
future commit the planning engine will use it to record the resource
instance dependencies explicitly in the generated execution graph.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
78ecc7b996 internal/execgraph: Builder.ProviderInstance must memoize
The whole point of this helper is to encapsulate the concern of having
exactly one open/close pair for each distinct provider instance address, so
in order to be effective it must actually save its results in the same
map it was already checking!

This was just an oversight in the original implementation that became more
apparent after having a visualization of execution graphs, since that made
it far more obvious that we were previously planning to open a separate
provider instance per resource instance.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
8f16d60d65 backend/local: New runtime impl can save plan files
This should be just enough saved plan file support to help us get an
execution graph saved so that it can be used in a subsequent apply step,
once we implement that.

As usual with the new runtime, the traditional plan file format is mainly
just acting as a vessel to transport the execution graph and so we need to
make it valid enough that the plan loader can load it but don't need to
make it fully consistent. Therefore for now the config snapshot is just
stubbed out as empty, with the assumption that our initial "walking
skeleton" implementation will just use the loose config files on disk for
now.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
9300e922e8 engine/planning: Populate ProviderAddr in planned changes
In order to produce a valid saved plan file we need to save information
about which provider instance each resource instance belongs to. We're
probably not actually going to use this information in the new
implementation because the same information is captured as part of the
execution graph, but we do at least need to make this valid enough that the
plan file loading code will accept it, because right now (for experimental
purposes) we're smuggling the execution graph through our traditional plan
file format as a sidecar data structure.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
f2184552ee engine/planning: Tolerate invalid plans from Terraform Plugin SDK
As with the traditional runtime, we need to tolerate invalid plans from
providers that announce that they are implemented with the legacy Terraform
Plugin SDK, because that SDK is incapable of producing valid plans.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
5abd519bef engine/planning: Send null ProviderMeta to providers
The RPC-based provider client panics if it isn't given a non-nil value for
ProviderMeta. We aren't yet ready to send a "real" ProviderMeta value, but
for now we'll just stub it out as a null value so that we have just enough
to get through the provider client code without crashing.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
1eb43a6d7e engine/planning: Don't panic if provider configuration fails
The code which tries to ensure that provider clients get closed when they
are no longer needed was not taking into account that a provider client
might not have actually been started at all, due to an error.

It's debatable whether we ought to start this background goroutine in that
case at all, but this is an intentionally-minimal change for now until we
can take the time to think harder about how the call to
reportProviderInstanceClosed should work (and whether it should happen at
all) in that case. This change ensures that it'll still happen in the
same way as it did before.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 09:50:36 -08:00
Martin Atkins
e0ca66869b go.mod: go get golang.org/x/net@v0.49.0
This is just a routine upgrade that should not significantly change
OpenTofu's behavior because it only affects the websocket and http2 server
implementations. OpenTofu does not directly use websockets at all and only
uses http2 server as part of the temporary server used by "tofu login"'s
OAuth implementation, and even that uses the copy of this library vendored
into the Go standard library instead of through the module dependency.

Due to the Go team's policy of ratcheting dependencies between these
modules this also requires an upgrade of golang.org/x/crypto, but the only
change in that module is relevant only in "fips140=only" mode, which is
already not supported for OpenTofu for various other reasons.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 07:45:30 -08:00
Martin Atkins
1792e85e0b configgraph: ResourceInstance.Value should use grapheval.Once
In e879e9060f I introduced the manually-written memoization that was
previously here, as a quick fix for a problem I noticed while working on
something else.

However, using sync.Mutex directly here is not correct because it makes it
possible for this function to deadlock if used incorrectly elsewhere in the
system. The "grapheval" utilities are there to avoid exactly that by making
a call fail immediately with an error if a self-dependency problem arises.

Therefore this will now use grapheval.Once to better encapsulate the
memoization. This both ensures that we cooperate well with the rest of the
system using grapheval and requires less boilerplate inside the Value
method because grapheval.Once is already tailored for exactly this sort of
memoization.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 07:45:10 -08:00
Martin Atkins
47826654d6 CHANGELOG: Entry for opentofu/opentofu#3681
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 07:43:32 -08:00
Martin Atkins
d8b057b064 configs: Skip provider ref validation when modules fail to load
We previously already did some partial skipping of provider reference
validation when there are modules in the tree that failed to load, but we
were still running the main logic that checks whether the providers passed
between module boundaries are consistent.

Because that validation involves checking consistency between different
modules it will tend to generate spurious errors when run against a
partially-loaded module tree. Therefore we must also skip the other
validation steps whenever at least one module failed to load, so that the
reported diagnostics will only describe the problem loading the module and
not produce additional misleading reports describing downstream problems
caused by a module's content being incomplete due to those errors.

This one is kinda awkward to write a test for because it's a very specific
interaction that seems unlikely to arise again, but just to have _some_
representation of this historical problem I wrote a simple test that
intentionally makes one module fail to load and then tests that the result
only contains the diagnostic related to that intentional failure. Before
this fix that test would fail because of the spurious additional errors
produced by the functions we're now skipping.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-16 07:43:32 -08:00
Andrei Ciobanu
6d2c5b2100 Render write-only attributes after rendered all of the other attributes (#3667)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-16 09:46:54 +02:00
Andrei Ciobanu
5c38e89361 Remove deferral capability leftover (#3676)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-16 09:30:37 +02:00
Andrei Ciobanu
66983273e5 Key provider decoding moved from gohcl to hcl/v2 (#3654)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
2026-01-15 17:51:16 +02:00
Martin Atkins
d244a28f75 go.mod: Routine upgrades of golang.org/x/* modules
This family of modules tend to ratchet forward their interdependencies even
when no upgrade is actually needed, so keeping the "easy" ones up to date
makes it more likely that we'd be able to upgrade the ones that require
more care and review if a security concern arises.

The four modules updated here only include interdependency ratchets and
changes to functionality that OpenTofu does not use, so this should not
affect OpenTofu's external behavior at all.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-12 11:58:47 -08:00
Andrei Ciobanu
6b3119c5c7 [main] Port the changes done in v1.10 for migration and installation guides (#3656)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-01-12 08:08:52 -05:00
baa-ableton
e1771c1f95 Module Expansion Transformer now skips creating edges for check related nodes (#3582)
Signed-off-by: Babur Ayanlar <babur.ayanlar@ableton.com>
Signed-off-by: baa-ableton <110462357+baa-ableton@users.noreply.github.com>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-11 19:14:47 -03:00
Martin Atkins
e06e12f98a go.mod: List our own tools in the "tools" directive
We previously adopted the new "tools" mechanism for the third-party tools
we use for go:generate, etc. However, it's also acceptable to include tools
from our own module in this list, which then makes it possible to run them
using the same "go tool" shorthand.

For example, it's now possible to run "go tool protobuf-compile" to rebuild
the protocol buffers schemas, or "go tool tofu" as a shorthand way to
compile and run OpenTofu CLI itself.

It still remains possible to run these tools in the same ways they used to
work. This is just a new way to get the same results through a more modern
Go toolchain feature.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-08 12:51:43 -08:00
James Humphries
16f6b2d119 Handle ignoring computed fields in ignore_changes blocks for testing (#3646)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2026-01-08 10:51:40 +00:00
Martin Atkins
65ee51c736 website: Boolean operator short-circuit was added in OpenTofu v1.10 (#3645)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-01-07 15:58:18 +00:00
Larry Bordowitz
32749c3012 updating comments on how we refer to documents
Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2026-01-06 11:34:45 -06:00
Larry Bordowitz
2f14a16c8a rfc: Improvements for Contribution Documents
Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2026-01-06 11:34:45 -06:00
Andy Hay
2c35bb8d19 cleanup: remove stale FIXME in tf provider (#3625)
Signed-off-by: Andrew Hay <andrew.hay@benchmarkanalytics.com>
2026-01-05 13:09:50 -05:00
Larry Bordowitz
9b2d29852b lint: reintroduce ST1012 static check
Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2026-01-05 11:54:37 -06:00
James Humphries
56b63795af Fix Http Backend failing to unlock state on Ctrl+C during apply (#3637)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2026-01-05 07:27:10 -05:00
Gajendra Gouda
014c999360 azure backend: resolve OIDC token dynamically to support ADO refresh (#3594)
Signed-off-by: gajjuu <gajendragouda254@gmail.com>
Signed-off-by: Gajendra Gouda <gajendragouda254@gmail.com>
2026-01-05 07:24:03 -05:00