Commit Graph

915 Commits

Author SHA1 Message Date
Christian Mesh
3488e85401 Add declRange to static eval call
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2026-03-25 14:26:36 -04: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
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
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
Christian Mesh
0832642188 tofu providers mirror: Add option to trust hashes from a mirror source (#3885)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: James Humphries <James@james-humphries.co.uk>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-19 14:00:51 -04:00
krishna sindhur
6a385c3cbc Read state refactor (#3706)
Signed-off-by: KrishnaSindhur <krishna.sindhur@harness.io>
Signed-off-by: krishna sindhur <krishna.sindhur@harness.io>
2026-03-19 17:03:16 +02:00
Martin Atkins
551579f5eb configs: New-style core version constraints, etc
Previously we interpreted a "required_version" argument in a "terraform"
block as if it were specifying an OpenTofu version constraint, when in
reality most modules use this to represent a version constraint for
OpenTofu's predecessor instead.

The primary effect of this commit is to introduce a new top-level block
type called "language" which describes language and implementation
compatibility metadata in a way that intentionally differs from what's used
by OpenTofu's predecessor.

This also causes OpenTofu to ignore the required_version argument unless
it appears in an OpenTofu-specific file with a ".tofu" suffix, and makes
OpenTofu completely ignore the language edition and experimental feature
opt-in options from OpenTofu's predecessor on the assumption that those
could continue to evolve independently of changes in OpenTofu.

We retain support for using required_versions in .tofu files as a bridge
solution for modules that need to remain compatible with OpenTofu versions
prior to v1.12. Module authors should keep following the strategy of
having both a versions.tf and a versions.tofu file for now, and wait until
the OpenTofu v1.11 series is end-of-life before adopting the new "language"
block type.

I also took this opportunity to simplify how we handle these parts of the
configuration, since the OpenTofu project has no immediate plans to use
either multiple language editions or language experiments and so for now
we can reduce our handling of those language features to just enough that
we'd return reasonable error messages if today's OpenTofu is exposed to
a module that was written for a newer version of OpenTofu that extends
these language features. The cross-cutting plumbing for representing the
active experiments for a module is still present so that we can reactivate
it later if we need to, but for now that set will always be empty.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-18 09:09:50 -07:00
Martin Atkins
a800d250e5 command: "go fix" on various files we've changed recently anyway
We don't typically just broadly run automatic rewriting tools like "go fix"
across our codebase because that tends to cause annoying and unnecessary
merge conflicts when we're backporting to earlier release branches.

But all of the files in this commit were changed in some non-trivial way
already during the OpenTofu v1.11 development period anyway, and so the
likelyhood we'd be able to successfully backport from them is reduced and
therefore this seems like a good opportunity to do some focused
modernization using "go fix".

My rules for what to include or not are admittedly quite "vibes-based", but
the general idea was:

 - Focusing on files under the "command" directory only, because that's
   already been an area of intentional refactoring during this development
   period.
 - If the existing diff in a file is already significantly larger than
   the changes the fixer proposed to make, or if the fixer is proposing
   to change a line that was already changed in this development period.
 - More willing to include "_test.go" files than non-test files, even if
   they hadn't changed as much already, just because backports from test
   files for bug fixes tend to be entirely new test cases more than they
   are modifications to existing test cases, and so the risk of conflicts
   is lower there.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-17 15:25:30 -07:00
Andrei Ciobanu
f805983ed4 Fix the simple-provider schema for data-source (#3884)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-16 15:25:55 +02:00
Andrei Ciobanu
a673617189 Refactor state rm command to use View instead of Ui and to use the arguments package (#3849)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-10 17:54:01 +02:00
Andrei Ciobanu
fc9c19eb9a Refactor state replace-provider command to use View instead of Ui and to use the arguments package (#3844)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-10 17:01:58 +02:00
Andrei Ciobanu
2ed9550790 Refactor state push command to use View instead of Ui and to use the arguments package (#3842)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-09 13:00:30 +02:00
Andrei Ciobanu
aeb3bfe452 Refactor state pull command to use View instead of Ui and to use the arguments package (#3837)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-09 12:25:18 +02:00
Andrei Ciobanu
315d028767 Refactor state mv command to use View instead of Ui and to use the arguments package (#3835)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-06 15:22:52 +02:00
Andrei Ciobanu
db00cb2f3b Refactor import command to use View instead of Ui and to use the arguments package (#3772)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-06 15:11:57 +02:00
Andrei Ciobanu
f9f8b1a258 Use the arguments already configured ViewOptions (#3836)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-05 15:33:15 +02:00
Andrei Ciobanu
5fcfb23eb5 Refactor fmt command to use View instead of Ui and to use the arguments package (#3805)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-05 14:47:37 +02:00
Andrei Ciobanu
383d6b3595 Refactor version command to use View instead of Ui and to use the arguments package (#3806)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-05 14:47:29 +02:00
Andrei Ciobanu
b992aa6582 Refactor taint && untaint commands to use View instead of Ui and to use the arguments package (#3818)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-05 09:50:36 +02:00
Andrei Ciobanu
9b389f7b1a Refactor providers lock command to use View instead of Ui and to use the arguments package (#3812)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-05 09:49:36 +02:00
Andrei Ciobanu
b3a6820bdf Refactor providers command to use View instead of Ui and to use the arguments package (#3811)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-05 09:49:15 +02:00
Andrei Ciobanu
7338f5748b Refactor graph command to use View instead of Ui and to use the arguments package (#3802)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-04 15:21:37 +02:00
Andrei Ciobanu
c98d5e22c7 Refactor providers mirror command to use View instead of Ui and to use the arguments package (#3813)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-04 15:20:39 +02:00
Andrei Ciobanu
1201c49010 Refactor unlock command to use View instead of Ui and to use the arguments package (#3823)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-04 15:20:19 +02:00
Andrei Ciobanu
6cd6a7e320 Refactor state list command to use View instead of Ui and to use the arguments package (#3828)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-04 15:20:06 +02:00
Andrei Ciobanu
0ffecc7a14 Refactor all workspace commands to use View instead of Ui (#3770)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-03 12:44:56 +02:00
Andrei Ciobanu
d701eecf47 Refactor console command to use View instead of Ui (#3764)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-03-02 18:58:11 +02:00
Andrei Ciobanu
b25f956321 Add -lock and -lock-timeout flags to the console command (#3800)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-02-25 17:36:19 +02:00
Christian Mesh
ef97fd2b51 Introduce plugin library and managers (#3652)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2026-02-24 08:51:48 -05:00
Andrei Ciobanu
9d1fe0fdd7 Refactor get command to use View instead of Ui (#3752)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-02-24 10:07:28 +02:00
Andrei Ciobanu
09fa061581 Refactor logout command to use View instead of Ui (#3761)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-02-24 10:05:54 +02:00
Andrei Ciobanu
a59b4843a0 Refactor login command to use View instead of Ui (#3757)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-02-17 00:29:59 +02:00
Andrei Ciobanu
5603b8a27c Refactor init command to use View instead of Ui (#3749)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-02-11 16:29:31 +02:00
Andrei Ciobanu
da0f45bf69 Move all implementation of flag.Value in one package (#3725)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-02-10 16:26:09 +02:00
Andrei Ciobanu
25d652dece -chdir unification with the workdir logic. Removal of workdir proxy methods from Meta (#3713)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-02-10 15:31:06 +02:00
Christian Mesh
08ba66ab6e Move new engine integration point into tofu.Context (#3718)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2026-02-03 09:07:54 -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
Denis O
9dbb5fcb9c Error checking simplifications (#3694)
Signed-off-by: Denis O <denis.o@linux.com>
2026-01-20 09:27:14 +00: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
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