Commit Graph

38 Commits

Author SHA1 Message Date
Christian Mesh
b6a6a44ba1 Remove global schema cache and clean up tofu schema/contextPlugins
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-12-11 15:04:12 -05:00
Diógenes Fernandes
e418276ed4 fix: use variables at enabled in nested modules (#3475)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-11-17 13:33:40 +00:00
James Humphries
f9abd97b91 Ensure Ephemeral values are handled by the diff transformer (#3495)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Co-authored-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
2025-11-14 12:18:05 +00:00
Diógenes Fernandes
176120f3e4 Implicit moves for modules (#3327)
Implicit move statement for modules previously using `count` and
then moving to use `enabled`, or vice versa.

Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-10-15 09:10:15 -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
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
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
f6b0ffd342 fix internal/tofu tests on Windows (#3194)
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
2025-08-27 18:57:59 -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
Martin Atkins
595eedbfc6 tofu: Make a few tests more robust against panicking
Some of our test cases expect that planning will fail but will still return
a non-nil plan with Errored set to true, and some other cases were not
expecting plan to fail at all, and in all of those cases a failure to meet
that expectation caused a panic rather than a test failure.

When debugging a problem that affects many tests it's annoying when the
test run panics partway through, so these small changes make these tests
a little more resilient to the system not behaving in the way they were
expecting, without affecting the behavior when the system behaves as
expected.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-07-08 07:28:32 -04:00
Martin Atkins
e389ae3974 providers: Recommend -exclude when provider can't plan
It seems that a small number of providers are now able to return a special
signal when they find that they are unable to perform an operation due to
unknown values in the provider or resource configuration.

This is a uses that new signal to recommend a workaround in that situation,
giving a more actionable error message than would've been returned by the
provider otherwise.

We've not yet decided how OpenTofu might make use of these new signals in
the long term, and so this is intentionally implemented in a way where
most of the logic is centralized in the provider-related packages rather
than sprawled all over "package tofu".

It's likely that a future incarnation of this will plumb this idea in more
deeply, but this is just a temporary stop-gap to give slightly better
error messages in the meantime and so it's better to keep it relatively
contained for now until we have a longer-term plan for what OpenTofu Core
might do with this information.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-06-13 09:17:36 -07:00
Christian Mesh
ff7ba7a95f Fix lint issues in internal/tofu (#2790)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2025-05-12 07:28:35 -04:00
Diógenes Fernandes
960edf3a83 refactor: eval_for_each checks (#2634)
Resolves #2532

The refactoring involves a few decisions:

When returning invalid values, we return the original value wrapped on NullVal. Before we were just returning  cty.NullVal(cty.Map(cty.DynamicPseudoType)) for everything.
When returning unknown values, we wrap it on UnknownVal. Previously we had a lot of different behaviors depending on the code path.
I decided to do that so we maintain a context of the types, without losing them when returning it to something that doesn't mean anything.


Signed-off-by: Diogenes Fernandes <diofeher@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
2025-04-23 09:16:13 -03:00
Ilia Gogotchuri
5968e195b0 Moved for different types (#2370)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Ilia Gogotchuri <ilia.gogotchuri0@gmail.com>
Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
2025-02-05 15:14:19 +04:00
Oleksandr Levchenkov
76d388b340 fix: provider not initialized in some cases (mostly, deposed) (#2335)
Signed-off-by: ollevche <ollevche@gmail.com>
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2025-01-08 12:34:52 -05:00
Ronny Orot
cf34b0e6a9 Skip imports on tofu destroy (#2214)
Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
2024-11-25 23:52:03 +02:00
Martin Atkins
1134f19467 tofu: Context.Apply now takes a context.Context
This continues our ongoing effort to get a coherent chain of
context.Context all the way from "package main" to all of our calls to
external components.

Context.Apply does not yet do anything with its new context, but this gets
the context plumbed in enough that we should be able to pass values like
telemetry spans all the way from the top-level in future.

OpenTofu has some historical situational private uses of context.Context
to handle the graceful shutdown behaviors. Those use context.Context as
a private implementation detail rather than public API, and so this commit
leaves them as-is and adds a new "primary context" alongside. Hopefully
in future refactoring we can simplify this to use the primary context also
as the primary cancellation signal, but that's too risky a change to bundle
in with this otherwise-mostly-harmless context plumbing.

All of the _test.go file updates here are purely mechanical additions of
the extra argument. No test is materially modified by this change, which
is intentional to get some assurance that isn't a breaking change.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2024-11-19 10:15:21 -08:00
Martin Atkins
3d5039f1f3 tofu: Context.Plan now takes a context.Context
This continues our ongoing effort to get a coherent chain of
context.Context all the way from "package main" to all of our calls to
external components.

Context.Plan does not yet do anything with its new context, but this gets
the context plumbed in enough that we should be able to pass values like
telemetry spans all the way from the top-level in future.

OpenTofu has some historical situational private uses of context.Context
to handle the graceful shutdown behaviors. Those use context.Context as
a private implementation detail rather than public API, and so this commit
leaves them as-is and adds a new "primary context" alongside. Hopefully
in future refactoring we can simplify this to use the primary context also
as the primary cancellation signal, but that's too risky a change to bundle
in with this otherwise-mostly-harmless context plumbing.

All of the _test.go file updates here are purely mechanical additions of
the extra argument. No test is materially modified by this change, which
is intentional to get some assurance that isn't a breaking change.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2024-11-19 10:15:21 -08:00
Christian Mesh
fd775f0fe3 Implement Provider for_each (#2105)
Signed-off-by: ollevche <ollevche@gmail.com>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
Co-authored-by: ollevche <ollevche@gmail.com>
Co-authored-by: Ronny Orot <ronny.orot@gmail.com>
Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
2024-11-05 18:08:23 -05:00
Arel Rabinowitz
3d4bf29c56 Add exclude flag support (#1900)
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2024-11-05 10:16:00 -05:00
Nathan Baulch
9b7bec31b4 Another batch of minor typos (#1953)
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2024-09-09 07:51:39 -04:00
Nathan Baulch
ea558d9d4b Fix typos (#1905)
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
2024-08-29 13:20:33 -04:00
Ronny Orot
884410e63a Add more tests and refactor import for_each (#1645)
Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
2024-07-26 11:01:47 -04:00
Andrew Hayes
3ef6d45afe Adds source context for the 'insufficient feature blocks' error (#1777)
Signed-off-by: Andrew Hayes <andrew.hayes@harness.io>
2024-07-09 09:56:07 +01:00
Ronny Orot
cc8d6e07f4 Fix bug in import 'to' parsing in json configurations (#1665)
Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
2024-05-27 11:49:30 +03:00
Ronny Orot
dcc1fa3b88 Support for_each syntax in import block (#1492)
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
Co-authored-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2024-04-17 17:12:10 +03:00
Arel Rabinowitz
63c88507a8 Make import block's to possibly more dynamic (#1270)
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
Co-authored-by: Ronny Orot <ronny.orot@gmail.com>
2024-04-15 13:06:35 +03:00
chenzj
dcec46ef0b Insert configuration marks to state value when import (#1350)
Signed-off-by: Zejun Chen <tibazq@gmail.com>
2024-03-28 11:19:22 -04:00
Ronny Orot
e9fe0f1118 Add support for removed block (#1158)
Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
2024-02-21 10:31:44 +02:00
Arel Rabinowitz
80f72cecfe Import ForEach: Prerequisite - Prepare codebase for dynamic addresses for ImportTargets (#1207)
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2024-02-08 16:05:12 +02:00
namgyalangmo
cb2e9119aa Update copyright notice (#1232)
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
2024-02-08 09:48:59 +00:00
Christian Mesh
c996be8d7d Allow known references in import blocks (#1105)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-01-12 07:23:25 -05:00
Christian Mesh
abd324ea7c Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
Janos
15bef1428a Fixes #898: Replace hashicorp and terraform references (#973)
Signed-off-by: Janos Bonic <86970079+janosdebugs@users.noreply.github.com>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
2023-12-08 08:03:09 -05:00
RLRabinowitz
e0ecd2ebb3 Use registry.opentofu.org as the default registry (#379)
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2023-10-03 10:49:38 +03:00
Dmitry Kisler
a127607a85 Rename terraform to tofu in GoString method and docstrings (#576)
Signed-off-by: Dmitry Kisler <admin@dkisler.com>
2023-09-26 19:09:27 +02:00
Yaron Yarimi
487d9bc6a4 Rename multiple packages to OpenTofu (addrs, backend, command) (#506) 2023-09-21 15:38:46 +03:00
Yaron Yarimi
794e3413bb Rename opentf package to tofu (#466) 2023-09-20 15:16:53 +03:00