Commit Graph

439 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Martin Atkins
92d8b4dd7d backend/remote-state/azure: go fix
This is the result of running the "go fix" modernizers on this package,
with no other changes.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-17 13:20:32 -07:00
Philipp Bandow
abb51ad21b backend auth: azurerm: add Azure DevOps/Pipelines OIDC auth (#3820)
Signed-off-by: Philipp Bandow <git@bandow.dev>
2026-03-09 12:01:21 -05:00
James Humphries
2c86fe8f85 Fix flakey TestS3LockingWritingHeaders test (#3839)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2026-03-05 16:15:15 +00: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
b108d3fb53 Add universe_domain to the gcs backend (#3758)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2026-02-12 11:46:18 +00: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
Larry Bordowitz
5f8ce97dcd azurerm: add client ID to MSI auth
Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2026-01-28 11:22:18 -06: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
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
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
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
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
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
Andrei Ciobanu
e8d1bb6882 Small tweaks on the guidelines and the scripts for testing the azure backend (#3603)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-12-18 08:58:33 +02:00
Ilia Gogotchuri
1eacb9a046 Retaining resources during destruction - New flag -suppress-forget-errors (#3588)
Signed-off-by: Ilia Gogotchuri <ilia.gogotchuri0@gmail.com>
2025-12-16 15:41:03 +04:00
Christian Mesh
ffc9c4d556 Split out provider schemas vs instances in new engine (#3530)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-12-01 13:09:58 -05:00
Martin Atkins
09815665de backend/local: Scaffolding for new runtime can use providers
This is some minimal glue to help the new runtime use the providers that
were gathered up by the existing logic in the "command" package.

This is cheating a little because this is relying on "tofu init" still
using the old approach just enough to find out which providers are needed
and get them installed, but our current focus is on the main plan and
apply phases and so it's convenient to be able to leave that part untouched
for now and return to improve it later, once we have more of the
fundamentals in place.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-11-21 09:20:59 -08:00
Martin Atkins
102449c9ec backend/local: Use experimental runtime for planning, when enabled
This is a relatively uninteresting milestone where it's possible to load
and plan a root module that contains nothing except local values and
output values.

The module loader currently supports only local sources and the plugin
APIs just immediately return errors, so configurations more complicated
than that are likely to just fail immediately with one or more errors.
We'll gradually improve on this in later commits.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-11-21 09:20:59 -08:00
Martin Atkins
367244a8f9 local/backend: Stub dependency fetchers for new runtime glue
None of these actually work yet, but this satisfies the new-style config
loader enough for it to return a real error instead of immediately
panicking.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-11-21 09:20:59 -08:00
Martin Atkins
ae60da8e7c backend/local: Initial sketch of new-engine planning
This doesn't actually work yet. It's just to sketch out a minimal overall
sequence of steps to make this behave somewhat like the main implementation
of "tofu plan", and then we'll make it work better in subsequent commits.

The main omission as of this commit is that we don't yet pass module,
provider, and provisioner dependency access objects in the EvalContext,
and so config loading immediately fails trying to request the root module
from a nil object.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-11-21 09:20:59 -08:00
Martin Atkins
ff5f45520d backend/local: Opt-in to experimental plan/apply/refresh functions
To facilitate early development and testing of the new language runtime
we're introducing a temporary mechanism to opt in to using the new codepaths
based on an environment variable. This environment variable is effective
only for experiment-enabled builds of OpenTofu, and so it will be
completely ignored by official releases of OpenTofu.

This commit just deals with the "wiring" of this new mechanism, without
actually connecting it with the new language runtime yet. The goal here
is to disturb existing codepaths as little as possible to minimize both
the risk of making this change and the burden this causes for ongoing
maintenance unrelated to work on the new language runtime.

This strategy of switching at the local backend layer means that we will
have some duplicated logic in the experimental functions compared to the
non-experimental functions, which is an intentional tradeoff to allow us
to isolate what we're doing so we don't churn existing code while we're
still in this early exploration phase. In a later phase of the language
runtime project we may pivot to a different approach which switches at
a deeper point in the call stack, but for now we're keeping this broad
to give us flexibility.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-11-21 09:20:59 -08:00
aleksandarss
730a60826c backend/tests: use workspace argument in testLocksInWorkspace (#3405)
Signed-off-by: aleksandarss <aleksandar-sasa.calic@hotmail.com>
2025-10-24 16:11:01 -04:00
Larry Bordowitz
8b99bac328 go.mod: upgrade tencent libraries (#3412)
Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2025-10-22 16:51:52 +01:00
Diogenes Fernandes
13f2a9fcec refactor: use TF_AZURE_TEST_CLIENT_* variables instead of default ones
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-10-22 11:44:39 -03:00
Diogenes Fernandes
8b4fcce514 test: allowing environment variables on azure acceptance tests
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-10-22 11:44:39 -03:00
Diogenes Fernandes
6a2bb41f9a test: avoid panics
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-10-22 11:44:39 -03:00
Martin Atkins
3426be27ef go.mod: go get k8s.io/client-go@v0.34.1
This also updates the other three k8s.io/* modules that we use, as
prerequisites for the upgrade.

The indirect dependency landscape for these modules has changed quite a lot
since the versions we were previously using, and so we have some new
indirect dependencies here. I quickly reviewed each of them and confirmed
that they seem to be under suitable licenses.

The k8s.io/utils/pointer package has been deprecated in favor of
k8s.io/utils/ptr, so this also updates our two callers of that to avoid
calling into deprecated functions.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-10-21 06:54:13 -07:00
Andrei Ciobanu
943c54079a go.mod: go get cloud.google.com/go/storage@v1.57.0 (#3385)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-10-17 18:16:53 +03:00
Martin Atkins
cc5d324098 go.mod: go get go.uber.org/mock@v0.6.0
This is just a routine upgrade. We use this dependency only in our tests,
so this upgrade does not risk changing OpenTofu's behavior. There do not
seem to be any concerning changes upstream.

There are some systematic changes to the shape of the generated mock code,
with the results also included in this commit.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-10-13 08:18:06 -07:00
Martin Atkins
cbfc28472d go.mod: Upgrade various golang.org/x/* dependencies
The Go team uses automation to generate unnecessary version bumps across
all of these that make it impossible to upgrade them individually because
they all mutually depend on the latest versions of each other, so
unfortunately we have to accept the risk of updating all of these at once
in order to update any one of them.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-10-10 08:23:54 -07:00
Martin Atkins
e74bf2d0a1 go.mod: Use the new "tool" directive
Previously the Go toolchain had no explicit support for "tools" and so we
used the typical Go community workaround of adding "tools.go" files (two,
for some reason) that existed only to trick the Go toolchain into
considering the tools as dependencies we could track in go.mod.

Go 1.24 introduced explicit support for tracking tools as part of go.mod,
and the ability to run those using "go tool" instead of "go run", and so
this commit switches us over to using that strategy for everything we were
previously managing in tools.go.

There are some intentional exceptions here:

- The protobuf-compile script can't use "go tool" or "go run" because the
  tools in question are run only indirectly through protoc. However, we
  do still use the "tool" directive in go.mod to tell the Go toolchain that
  we depend on those tools, so that it'll track which versions we are
  currently using as part of go.mod.
- Our golangci-lint Makefile target uses "go run" to run a specific
  version of golangci-lint. We _intentionally_ don't consider that tool
  to be a direct dependency of OpenTofu because it has a lot of indirect
  dependencies that would pollute our go.mod file. Therefore that continues
  to use "go run" after this commit.
- Both of our tools.go files previously referred to
  github.com/nishanths/exhaustive , but nothing actually appears to be
  using that tool in the current OpenTofu tree, so it's no longer a
  dependency after this commit.

All of the dependencies we have _only_ for tools are now classified as
"indirect" in the go.mod file. This is the default behavior of the Go
toolchain and appears to be motivated by making it clearer that these
modules do not contribute anything to the runtime behavior of OpenTofu.
This also corrected a historical oddity in our go.mod where for some reason
the "indirect" dependencies had been split across two different "require"
directives; they are now all grouped together in a single directive.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-10-10 07:06:56 -03:00
Larry Bordowitz
bcbfebce3d Implement the Azure Key Provider
This uses the same auth package as the newly-rewritten Azure State
Backend, so many of the properties and environment variables are the
same. I have put this through both the compliance test as well as built
the binary and run some end-to-end tests, and found that it
appropriately uses the Azure key as expected.

Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2025-09-29 06:19:02 -04:00
Diógenes Fernandes
4c7122ba19 fix internal/backend/local tests by closing file handle properly (#3284)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-22 11:24:42 -03: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
2d5ea98257 skip timeout lock tests on windows (#3288)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-17 16:56:19 -03:00
Larry Bordowitz
0090e8a18c Add new configuration to AzureRM Backend (#3251)
Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2025-09-15 19:22:17 +01: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
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
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
Larry Bordowitz
63e8845ad9 Refactor the azurerm backend (#3034)
Signed-off-by: Larry Bordowitz <laurence.bordowitz@gmail.com>
2025-09-03 11:06:11 -04:00
Diógenes Fernandes
35a3100cfe Fix http test server errors on TestBackendConfig_Authentication by removing usage of os.Clearenv (#3221)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-09-02 16:15:30 -03:00
Christian Mesh
9583256ca1 Remove all calls to DeepCopy in resource instance write codepath (#3110)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-02 07:24:53 -04:00