Commit Graph

832 Commits

Author SHA1 Message Date
Andrei Ciobanu
7ef6251591 Plan now renders write-only attributes that require replace (#3296)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-09-22 17:15:20 +03:00
James Humphries
1e8ccb8d96 fix: Prevent nil panic in marshalProviderConfigs when inSingleModuleMode (#3294)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2025-09-22 13:40:48 +01:00
Andrei Ciobanu
cf971eb3b6 Rework the way ephemeral variables are used when given on tofu apply command (#3192)
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>
2025-09-22 09:31:19 +03:00
Diógenes Fernandes
767dd7a2fa fix: DirFromModule related tests on Windows (#3289)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-20 15:51:29 -03:00
Diógenes Fernandes
197135b4af fix internal/command tests by triggering garbage collection (#3282)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-17 09:06:57 -03:00
Diógenes Fernandes
3a8506b14e fix: TestPlan_generatedConfigPath on Windows by standardizing line breaks (#3274)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-16 16:11:52 -03:00
Diógenes Fernandes
189c4535f1 Using forward slashes in PackageDir to fix providercache tests in Windows (#3233)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-16 09:38:04 -03:00
Martin Atkins
5fa35c5601 backend+command: Alias names for backend types
This introduces the concept of "backend aliases", which are alternative
names that can be used to refer to a given backend.

Each backend type has one canonical name and zero or more alias names. The
"backend" block in the root module can specify either a canonical backend
type or an alias, but internally OpenTofu will always track the backend
type using its canonical name.

In particular, the following are all true when the configuration specifies
an alias instead of a canonical backend type:
- The "tofu init" output includes a brief extra message saying which
  backend type OpenTofu actually used, because that is the name that we'd
  prioritize in our documentation and so an operator can use the canonical
  type to find the relevant docs when needed.
- The .terraform/terraform.tfstate file that tracks the working directory's
  currently-initialized backend settings always uses the canonical backend
  type, and so it's possible to freely switch between aliases and canonical
  without "tofu init" thinking that a state migration might be needed.
- Plan files similarly use the canonical backend type to track which
  backend was active when the plan was created, which doesn't have any
  significant user-facing purpose, but is consistent with the previous
  point since the settings in the plan file effectively substitute for
  the .terraform/terraform.tfstate file when applying a saved plan.
- The terraform_remote_state data source in the provider
  terraform.io/builtin/terraform accepts both canonical and alias in its
  backend type argument, treating both as equivalent for the purpose of
  fetching the state snapshot for the configured workspace.

The primary motivation for this new facility is to allow the planned
"oracle_oci" backend to have an alias "oci" to allow writing configurations
that are cross-compatible with HashiCorp Terraform, since that software
has chosen to have unqualified OCI mean Oracle's system, whereas OpenTofu
has previously established that unqualified OCI means "Open Container
Initiative" in our ecosystem.

In particular, this design makes it possible in principle to bring an
existing Terraform configuration specifying backend "oci" over to OpenTofu
without modifications, and then to optionally switch it to specifying
backend "oracle-oci" at a later time without a spurious prompt to migrate
state snapshots to the same physical location where they are already
stored.

This commit doesn't actually introduce any aliases and therefore doesn't
have any tests for the new mechanism because our backend system uses a
global table that isn't friendly to mocking for testing purposes. I've
tested this manually using a placeholder alias to have confidence that it
works, and I expect that a subsequent commit introducing the new
"oracle_oci" backend will also introduce its "oci" alias and will include
tests that cover use of the alias and migration from the alias to the
canonical name and vice-versa.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-09-11 11:33:53 -07:00
Martin Atkins
2d2b08517e cliconfig: Registry protocol retry count and timeout settings
These were previously settable only via environment variables. These are
now handled as part of CLI Configuration and so also settable in a new
"registry_protocols" block in a CLI configuration file, with the
environment variables now treated as if they are an additional virtual
configuration file containing the corresponding settings.

This handles our settings in our modern style where package cliconfig is
responsible for deciding the configuration and then package main reacts
to that configuration without being aware of how it is decided.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-09-10 11:45:38 -07:00
Diógenes Fernandes
e76a772102 fix: ephemeral end-to-end tests on Windows (#3259)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-10 12:07:24 -03:00
Christian Mesh
c8b58e949b Address review comments
Co-authored-by: James Humphries <James@james-humphries.co.uk>
Co-authored-by: Ilia Gogotchuri <ilia.gogotchuri0@gmail.com>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00
Andrei Ciobanu
1bab9aff46 Ephemeral todos handling (#3177)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00
Andrei Ciobanu
ccfeb83889 Renderer keys validation - remove the else branch since does not make sense anymore (#3176)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00
Andrei Ciobanu
7f76707dd0 Ephemeral write only attributes (#3171)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00
Christian Mesh
6437bfe01f Add tofu.applying (and terraform.applying) (#3170)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00
Christian Mesh
4ad9dfa716 Address ephemeralasnull comments/TODOs (#3169)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00
Andrei Ciobanu
b5d414331f Ephemeral outputs (#3123)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00
Andrei Ciobanu
013097b631 Ephemeral variables (#3108)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00
Diógenes Fernandes
e8eeb1334c Adapt TestInit hashes to work on Windows (#3208)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-09 11:59:40 -03:00
Diógenes Fernandes
22910f2b01 Adapt statelocker usage to Windows (#3206)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-06 10:47:17 -03:00
Christian Mesh
fd4e426a12 Fix test crash when using deprecated outputs in the root module (#3249)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-05 14:41:32 -04:00
Diógenes Fernandes
c94c96864c Show a change reason on enabled meta-argument when deleting (#3248)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-05 14:38:28 -03:00
Larry Bordowitz
45e379b4be Remove unused CLI config fields
Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2025-09-03 14:06:36 -07:00
Diógenes Fernandes
720961605d Replace AWS with local provider to fix end-to-end test on darwin_amd64 (#3224)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-03 09:04:12 -03:00
Diógenes Fernandes
07a34d8e54 Close the file handlers in TestWorkspace_deleteWithState after use (#3230)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-02 16:07:35 -03:00
Diógenes Fernandes
c2351ec8d9 Normalize paths in TestNewDiagnostic test (#3216)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-02 16:06:59 -03:00
Diógenes Fernandes
32c93ed431 Fix TestShow* error messages on Windows tests (#3231)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-02 16:06:38 -03:00
Diógenes Fernandes
988c595d5a Normalize paths in TestTest_* on Windows (#3228)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-02 16:05:39 -03:00
Ilia Gogotchuri
2c68afe753 CLI import target validation for incorrect for_each keys (#3106)
Signed-off-by: Ilia Gogotchuri <ilia.gogotchuri0@gmail.com>
2025-09-02 13:21:19 +04:00
Diógenes Fernandes
1e48db34a4 fix missing TestConsole* tests on Windows (#3213)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-08-29 14:32:33 -03:00
Diógenes Fernandes
91f7df965f Fix internal/command/validate_test.go: TestValidate_json* (#3202)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-08-29 14:16:47 -03:00
Diógenes Fernandes
1099db8569 fix TestJSON* tests on Windows (#3207)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-08-29 12:41:21 -03:00
Diógenes Fernandes
4ebcf025c6 fix TestConsole* tests on Windows (#3205)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-08-28 20:01:11 -03:00
Diógenes Fernandes
4c2b1df36e fix TestApply* and TestInit* on Windows (#3203)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-08-28 19:55:45 -03:00
Diógenes Fernandes
fda6df4974 fix TestMeta* on Windows (#3201)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-08-28 12:19:00 -03:00
Diógenes Fernandes
7c3e3a3e09 fix internal/command/cliconfig tests on Windows (#3196)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-08-27 18:56:50 -03:00
Martin Atkins
15272f8672 plan diff: summarize the current -> planned notation
The human-oriented plan output includes a short summary of the meaning of
all of the different "icons" used to describe different kinds of change,
but nothing was previously describing how OpenTofu uses "->" to describe
the transition between current and planned values for update in-place, "~".

We'll now include a concise note about that as part of the icon summary,
keeping things still relatively compact but nonetheless giving something
to refer to if a reader is unsure about the meaning of this notation.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-08-26 11:37:44 -07:00
Diógenes Fernandes
dfc1a4e948 feat: allow calling functions from unconfigured providers when no resources are referenced (#3118)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
Signed-off-by: Diógenes Fernandes <diofeher@gmail.com>
Co-authored-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-08-22 14:50:17 -03:00
Diógenes Fernandes
11d416edf9 add for_each attribute to the mock_provider block (#3087)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-08-18 10:36:04 -03:00
James Humphries
c5fd93482a Fix crash in unmarkDeepWithPathsDeprecated (#3105)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Signed-off-by: James Humphries <James@james-humphries.co.uk>
Co-authored-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-08-06 15:40:19 +01:00
Andrei Ciobanu
a6c296ddb6 Make ephemeral workflow e2e test to run correctly on windows too - second attempt (#3097)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-08-04 18:24:47 +03:00
Andrei Ciobanu
a9a7012396 Adjust the ephemeral workflow e2e test to run correctly on windows too (#3096)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-08-04 17:33:28 +03:00
Andrei Ciobanu
4077c3d84f Feature branch: Ephemeral resources (#2852)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-08-04 16:39:12 +03:00
Christian Mesh
1d38fd69d8 Switch from polling to native blocking locking for the provider cache (#3090)
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>
2025-08-01 10:17:33 -04:00
Andrei Ciobanu
01493c357f Update apply documentation with the newly accepted -var/-var-file arguments (#3091)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-08-01 16:25:39 +03:00
Christian Mesh
be433be96f Support for static variables used with encrypted plans (#1998)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Co-authored-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-07-28 12:11:43 -04:00
Christian Mesh
3c76c5f419 Use the correct data when mocking a resource refresh (#3068)
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-07-25 22:00:43 -03:00
Diógenes Fernandes
5fb4a1aed2 Using a Key on ExtraInfo to differentiate between Consolidation Warnings (#3036)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
Signed-off-by: Diógenes Fernandes <diofeher@gmail.com>
2025-07-24 12:20:57 -03:00
Diógenes Fernandes
e718044193 docs: consolidate warnings are enabled by default (#3064)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-07-23 17:35:59 -03:00
Ilia Gogotchuri
dd2ace53e2 Diffing lists containing multiline strings (#3030)
Signed-off-by: Ilia Gogotchuri <ilia.gogotchuri0@gmail.com>
2025-07-18 20:44:05 +04:00