Commit Graph

2912 Commits

Author SHA1 Message Date
Christian Mesh
040a8d792d Inline functions experiment
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2026-04-17 08:38:30 -04:00
ogormans-deptstack
6a09262c97 local-exec: propagate TRACEPARENT to child processes
This allows child processes launched with local-exec to contribute to the same trace that OpenTofu started.

Signed-off-by: ogormans-deptstack <sean.ogorman@deptagency.com>
2026-04-15 13:40:31 -07:00
Diógenes Fernandes
2c7cd8546c fix: showSensitive working for provisioners output (#3931)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2026-04-15 09:39:53 -03:00
Christian Mesh
2e3fb16b8b Add additional panic info and buffer panic message (#4026)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2026-04-13 12:11:34 -04:00
Martin Atkins
82da43c81b tofu: A better error message for WinRM support being removed
The previous commit already removed WinRM support and made it return a
relatively-terse error message, but during the v1.13 release series we'd
like to use a more helpful error message that includes a link to
Microsoft's documentation about enabling an OpenSSH server to use as an
alternative.

This commit is designed to be reverted during the v1.14 period so that
we'll just fall back on the error message already implemented in
"package communicator". This new message needs to be implemented outside
of the communicator abstraction because that old API doesn't support
returning diagnostics, but it's not worth the risk to refactor it just for
an error message we're intending to remove in the next release series
anyway.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-09 13:22:27 -07:00
Martin Atkins
30db471ac0 provisioners: remove WinRM support
The upstream libraries we use to implement this feature are in various
states of unmaintained-ness where we've not been able to upgrade them
beyond the old versions we're currently using without them no longer
working well together.

Therefore we previously made this connection type produce a deprecation
warning in OpenTofu v1.12, and now we're making it produce an error instead
and so we can remove all of our code that was calling in to those
dependencies.

Although this is a breaking change, we're justifying it under the
"external dependencies" pragmatic exception in our compatibility promises:
external software has changed in a way that makes it no longer viable to
offer this feature. Modern Windows has built-in support for running an
OpenSSH server, and so we expect that most folks who were previously
relying on WinRM should be able to migrate to using SSH instead.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-09 13:22:27 -07:00
Martin Atkins
bea94265f3 views: TestStateViews non-hardcoded "terraform_version"
The "terraform_version" property of the JSON state format (intentionally
misnamed for backward-compatibility with our predecessor) changes each time
we make a new release, so we'll compare it with the currently-expected
version number instead of with a hard-coded value.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-08 14:53:40 -07:00
ogormans-deptstack
fb45eceae5 provisioners: thread context.Context through ProvisionResource interface
This is to give provisioners access to trace span metadata, which we'll make use of in later commits.

Signed-off-by: ogormans-deptstack <sean.ogorman@deptagency.com>
2026-04-08 08:13:51 -07:00
Larry Bordowitz
a0354c6f10 remote-exec: fix Powershell - only quote args, not command
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2026-04-07 13:46:47 -05:00
Martin Atkins
4cca9f1611 instances: Fix data race in GetDeepestExistingModuleInstance
All of the exported querying methods of Expander are supposed to hold a
read lock whenever they Expander.exps, but this particular method was
missing those calls and so it could potentially race with calls that write
new expansions into the data structure.

This seems to be quite hard to hit in practice because it can only arise
if you have an "orphan" resource instance whose node happens to execute
concurrently with the expansion node for a module or resource, but
the race detector can sometimes catch it when executing
TestContext2Apply_providerModuleIteration/apply_orphan_destroy from
"package tofu".

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-07 14:13:51 -04:00
Andrei Ciobanu
ce59943d99 Remove Ui from the Meta structure (#4000)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
2026-04-07 13:38:46 -04:00
Legin
032ec9e542 Add support for Customer Provided Keys and Customer managed keys in AzureRM backend (#3886)
Signed-off-by: Legin-ML <leginml2004@gmail.com>
Signed-off-by: Legin <140829993+Legin-ML@users.noreply.github.com>
2026-04-07 11:11:17 -05:00
Christian Mesh
505f87900a Deprecated resource blocks attrs (#3973)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
Co-authored-by: Andrei Ciobanu <andreic9203@gmail.com>
Co-authored-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-04-07 10:30:43 -04:00
Andrei Ciobanu
030e34725c Migrate cloud and remote backends to the views package (#3982)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-04-07 10:15:05 +03:00
ogormans-deptstack
c1b7229bbd statemgr: pretty-print local backend state files for readable diffs (#3922)
Signed-off-by: ogormans-deptstack <sean.ogorman@deptagency.com>
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-06 07:25:03 -04:00
Diógenes Fernandes
893b41f65c fix: validation for replace_triggered_by (#3967)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2026-04-02 18:40:39 -03:00
Christian Mesh
ff2957f08e go.mod: Bump google deps (#3984)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-02 14:40:43 -04:00
Christian Mesh
55ef1669b2 Support const variables in static eval (#3946)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-02 07:39:54 -04:00
Christian Mesh
1fb9cb43ba Add warning when provider symlinks fail (#3974)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-02 07:36:10 -04:00
James Humphries
c874a1c8fd Fix flaky TestJsonIntoStream by not comparing elapsed durations between runs
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2026-04-02 07:11:07 -04:00
James Humphries
f81a5fca52 Improve resource identity rendering in plan output and import hooks (#3883)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2026-04-02 12:08:04 +01:00
Andrei Ciobanu
04f0688500 Fix internal/cloud tests that were missed from being updated when the changes that broke these were added (#3975)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-04-02 07:52:03 +03:00
Martin Atkins
ef4a93bb72 states: Improve confusing comment for DeepCopy of local values
The comment here was trying to say that we don't need to _deep-copy_
cty.Value values, but it wasn't clear about that and so it seemed weird
to have a comment saying that copying isn't needed right before a call to
a function called "Copy".

This updates the comment to be more explicit, and also takes the
opportunity to simplify to use maps.Clone instead of maps.Copy, since we
have no need for the intermediate empty map we were previously creating
prior to the Copy call.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-01 11:48:31 -07:00
Martin Atkins
a803f4cc2f states: go fix various files that changed recently
We already changed these files considerably in opentofu/opentofu#3671, so
we'll take this opportunity to modernize the rest of the code while the
likelihood of successful clean backporting from this file is pretty low
anyway.

In the case of instance_object_src_test.go some additional editing was
required because uint64Ptr becomes unused when we adopt the built-in "new"
function, which would cause this file to fail the dead code lint.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-01 11:48:31 -07:00
Christian Mesh
4ccf87ebee Update plugin protos to 5.10 and 6.10
This is from the MPL2.0 licensed source

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2026-04-01 11:43:57 -04:00
James Humphries
c88018bac0 Add resource identity schemas to tofu provider schemas output (#3898)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2026-04-01 15:50:12 +01:00
Andrei Ciobanu
498a572242 Always return null value for write-only attributes from the mock provider for 'tofu test' (#3965)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-04-01 16:01:33 +03:00
Martin Atkins
45e203998b plugin+plugin6: go fix grpc_provider.go and its tests
We already changed these files considerably in opentofu/opentofu#3671, so
we'll take this opportunity to modernize the rest of the code while the
likelihood of successful clean backporting from this file is pretty low
anyway.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-04-01 06:36:02 -04:00
James Humphries
317de6d46e Store BeforeIdentity and AfterIdentity and display it in the plan json output (#3779)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2026-04-01 10:46:38 +01:00
James Humphries
19af81d28e Implement resource identity support (#3671)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-31 16:57:21 +01:00
Andrei Ciobanu
b5010cb952 Remove GatherVariables methods (#3962)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-31 14:22:31 +03:00
Andrei Ciobanu
b53682ace6 Remove Meta not needed functionality (#3958)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-31 10:15:13 +03:00
Andrei Ciobanu
e789a7f63c Remove show diagnostics (#3950)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-30 16:00:21 +03:00
Andrei Ciobanu
8689efa1f1 Add backend view and migrate outputs (#3949)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-30 15:35:09 +03:00
RoseSecurity
6e2250e050 chore: typo fixes (#3957)
Signed-off-by: RoseSecurity <michael@rosesecurity.dev>
2026-03-27 18:25:56 -03:00
Andrei Ciobanu
440edcd754 Deny ephemeral values in count (#3924)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-27 20:24:15 +02:00
Andrei Ciobanu
1b5af7a229 Rework ephemeral resources apply phase (#3897)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-27 20:00:13 +02:00
Andrei Ciobanu
866b067c0d Unify patterns across the refactored commands (#3941)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-26 17:19:27 +02:00
James Humphries
cdca26fa4e Added deprecation notice for winrm provisioner connections (#3899)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-26 07:15:24 -04:00
Andy Brody
dbe023fdf6 Add .tofu/.tofutest.hcl to tofu fmt error message. (#3947)
Signed-off-by: Andy Brody <git@abrody.com>
2026-03-25 16:01:18 -04:00
Martin Atkins
3c08c90dd3 keyprovider/openbao: Some brief instructions for testing
These tests currently require some manual setup to be able to run in
acceptance test (rather than unit test) mode, so this comment just captures
those steps so we can find them more easily in future.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-25 10:19:03 -07:00
Martin Atkins
84b2cbd685 backend/consul: Fix TestConsul_destroyLock test
This test appears to have been written to use the current timestamp in the
Consul keys it uses for testing just to minimize the risk of collisions
with objects already present in the KV store.

Unfortunately, modern Consul now rejects this shape of key because the
default string representation of a timestamp includes characters that
Consul does not allow. This commit changes it to use a decimal
representation of the integer unix timestamp representation instead, which
achieves a similar result using a less disruptive set of characters.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-25 00:34:52 -07:00
Martin Atkins
9568e66ea2 backend/pg: Use a guaranteed-invalid host for invalid hostname test
"hostthatdoesnotexist" is not a hostname that is guaranteed to be unused,
and on some systems a hostname without any dots causes an implicit search
within various domain suffixes. There is no explicitly-specified rule for
what error should be returned when suffix-based search fails, so different
implementations handle that differently and this test was not written to
tolerate those differences, causing false failures.

The "invalid" top-level domain is reserved by RFC 6761 and required to
always cause the NXDOMAIN error, which is the DNS error required to produce
the error message this test expects.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-24 17:31:01 -07:00
krishna sindhur
cc633afdb9 fix: remove OPENTOFU_USER_AGENT (#3923)
Signed-off-by: KrishnaSindhur <krishna.sindhur@harness.io>
2026-03-23 21:09:56 -03:00
Martin Atkins
48e906a31e backend/kubernetes: A short note on running acctests with minikube
I've had to remind myself of all of these setup steps each time I've run
the acceptance tests, so I'm just noting some details here to make it
easier for me or someone else to perform the same setup in future.

Maybe we'll build some automation around this someday, but for now I'm
mainly motivated by using these tests to verify a routine upgrade of all
of the libraries that this backend depends on, in preparation for the
OpenTofu v1.12 series.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-23 08:12:20 -07:00
Andrei Ciobanu
c4b269eb87 Refactor state show command to use View instead of Ui and to use the arguments package (#3865)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-23 13:23:41 +02:00
Andy Hay
5179bab7e5 e2etest: strip state_lock messages in TestJsonIntoStream
On Windows, the two sequential plan runs in TestJsonIntoStream have different latencies — the -json-into run is consistently slower and crosses the timer threshold that emits state_lock_acquire, while the -json run does not. This causes a spurious one-line diff between the two outputs.

Strip state_lock_acquire/release lines from both outputs before comparison since these messages are timing-dependent and not relevant to the test's core assertion.
2026-03-20 12:02:46 -07:00
Andy Hay
070698be32 Refactor providers schema command to use views and arguments packages (#3822)
Signed-off-by: Andrew Hay <andrew.hay@benchmarkanalytics.com>
Signed-off-by: Andy Hay <39sumer3939@gmail.com>
Signed-off-by: Andy Hay <andrew.hay@benchmarkanalytics.com>
Co-authored-by: Andrei Ciobanu <andreic9203@gmail.com>
2026-03-20 16:43:20 +02:00
Martin Atkins
5a120bf9b8 go.mod: Upgrade protobuf and grpc libraries
This is a routine upgrade. OpenTofu directly uses these libraries as part
of implementing the provider plugin protocol, but they are also used
indirectly by the libraries we use to interact with OpenTelemetry
collectors and some Google APIs and so the impact of upgrading these is
always quite tricky to evaluate.

However, I've reviewed the changes between these releases and it seems like
there are no behavior changes that would be significant for the use-cases
OpenTofu cares about. The gRPC library in particular has had a lot of
commits since we last upgraded it, but many of them are performance
improvements in the implementation details rather than significant behavior
changes.

This also includes the result of running "make protobuf" with the updated
version of the protobuf code generator, which for this release has merely
changed the version number recorded in the comments.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-19 11:21:15 -07:00
Christian Mesh
e9f27daa06 Replace h1,zh check with PreferredHashes (#3909)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2026-03-19 14:19:11 -04:00