Commit Graph

342 Commits

Author SHA1 Message Date
Andrei Ciobanu
eba25e2fed
Add the initial implementation for s3 locking (#2521)
Signed-off-by: yottta <andrei.ciobanu@opentofu.org>
2025-02-25 14:17:30 +02:00
Andrei Ciobanu
a3276028ad
Upgrade aws sdk to a version that will give us access to s3 conditional writes arguments (#2528)
Signed-off-by: yottta <andrei.ciobanu@opentofu.org>
2025-02-18 15:58:17 +02:00
Oleksandr Levchenkov
2a4d81042b
make pg backend acquire schema-based global locks (#2411)
Signed-off-by: ollevche <ollevche@gmail.com>
2025-01-31 14:21:36 +02:00
Haider Bari
6614782e6d
Improved error messages for lock-related problems in the s3 backend (#2410)
Signed-off-by: Bari, Haider <haider.bari@fmr.com>
Co-authored-by: Bari, Haider <haider.bari@fmr.com>
2025-01-29 11:20:28 -05:00
Christian Mesh
87cd9227dc
Fix S3 acceptance test panic, introduced in 1.7 encryption (#2420)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-01-24 09:59:43 -05:00
Haider Bari
be72380cdb
"force-unlock" support for the HTTP backend (#2381)
Signed-off-by: Bari, Haider <haider.bari@fmr.com>
Co-authored-by: Bari, Haider <haider.bari@fmr.com>
2025-01-22 19:05:57 -05:00
James Humphries
c1f1008723
Replace mock module with go.uber.org/mock (#1673)
Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Co-authored-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
2025-01-10 08:29:20 -05:00
Martin Atkins
ad32bde2ae Temporarily disable the complexity-related lint rules
We're intending to gradually improve all of the existing functions that
fail these checks as a separate project from other work, because fixing
for these particular lint rules tends to be too invasive to be safe or
sensible to combine with other work.

Therefore we'll temporarily disable these lints from the main lint run
and add a separate .golangci-complexity.yml that we can use to track our
progress towards eliminating those lint failures without continuing to
litter the code with nolint comments in the meantime.

This also removes all of the existing nolint comments for these linters so
that we can start fresh and review each one as part of our improvement
project.

We'll re-enable these linters (and remove .golangci-complexity.yml) once
each example has either been rewritten to pass the checks or we've
concluded that further decomposition would hurt readability and so added
"nolint" comments back in so we can review whether our lint rules are too
strict once we've got a bunch of examples to consider together.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-01-03 10:41:05 -05:00
Ilia Gogotchuri
ffa43acfcd
Azurerm backend timeout (#2263)
adds a timeout_seconds configuration variable with a default value to the AzureRM backend
Signed-off-by: Ilia Gogotchuri <ilia.gogotchuri0@gmail.com>
2024-12-06 17:32:23 +04:00
Haider Bari
dbea01eea6
Add DEBUG-level logging to the "http" state storage backend (#2120)
Signed-off-by: Bari, Haider <haider.bari@fmr.com>
Co-authored-by: Bari, Haider <haider.bari@fmr.com>
2024-11-20 16:36:45 +02:00
Martin Atkins
a8b6342556 tofu: Context.Input 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.Input now passes this through to the UI input implementation,
which was already written to handle cancellation. However, that
implementation currently handles interruption itself by directly watching
for the interrupt signal and so we remove the cancellation from the
context for now to avoid changing how interrupts are handled. Hopefully
in future we can remove the inline SIGINT handling from the UIInput
implementation and use its context-cancellation-handling instead.

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
9cadb097ba tofu: Context.Validate 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.Validate doesn't yet do anything with its new context, but we'll
plumb this deeper in future.

Since the local backend's implementation of backend.Local.LocalRun calls
Validate on the given configuration before returning, it this also extends
that interface method to take a context, and so the various commands that
directly create "local runs" (rather than going through the backend
operation API) now all pass in a context derived from the one created
in "package main".

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
3b79efa834 tofu: Context.Refresh 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.Refresh is really just a vestigal wrapper around Context.Plan, so
this just passes the given context through to Context.Plan which itself
currently ignores it.

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
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
Martin Atkins
35bedc479f command: Meta.RunOperation takes a context.Context
This is part of an ongoing effort to plumb a properly-connected series of
contexts through all of the layers where we might want to generate
telemetry (or similar) in future.

This is _just enough_ to connect the top-level context created by package
main with the various child contexts created by the local backend, so
that they could in principle access the root span that package main
generates.

This is not yet sufficient to propagate the context all the way into the
language runtime. More plumbing to follow in later commits!

This intentionally does not introduce any new OpenTelemetry-specific
context: the goal is only to get the context chain in place so that we
can use it for telemetry delivery in future.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2024-11-19 10:15:21 -08:00
Haider Bari
eb15415a2d
"http" backend to return existing lock metadata on lock conflict, rather than new lock metadata (#2090)
Signed-off-by: Bari, Haider <haider.bari@fmr.com>
Co-authored-by: Bari, Haider <haider.bari@fmr.com>
2024-11-19 14:57:19 +02: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
Martin Atkins
6707ef6ca3
Fix regression of backend reinit detection when backend schema has required arguments (#2119)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2024-11-04 14:23:32 -05:00
Alexandru Trendler
48abc52e46
bug: add error handling for missing state lock config in S3, HTTP and OSS backends (#1977)
Signed-off-by: g0dfl3sh <alex1trendler@gmail.com>
Signed-off-by: Alexandru Trendler <117138249+g0dfl3sh@users.noreply.github.com>
Co-authored-by: Oleksandr Levchenkov <ollevche@gmail.com>
2024-09-20 18:29:36 +02: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
James Humphries
cc91bf25f5
use dynamic types when handling variables during plan and show static evaluation (#1826)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2024-07-17 11:46:24 -04:00
Denis O
864aa9d1d6
Error handling fixes (#1816)
Signed-off-by: Denis O <denis.o@linux.com>
2024-07-15 11:58:43 +02:00
Christian Mesh
2c5c8a5f72
Fix plan static variable injection (#1771)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Co-authored-by: James Humphries <james@james-humphries.co.uk>
2024-07-09 07:17:45 -04:00
Christian Mesh
8f8e0aa4aa
Static Evaluation Base, Module Sources, Backend Config (#1718)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Christian Mesh <cristianmesh1@gmail.com>
Co-authored-by: James Humphries <James@james-humphries.co.uk>
Co-authored-by: Oleksandr Levchenkov <ollevche@gmail.com>
2024-06-24 09:13:07 -04:00
Janos
261b966562
Fixes #1594: Support lower-case http/https_proxy env variables in S3 backend (#1736)
Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>
2024-06-20 11:11:19 -04:00
Arel Rabinowitz
927d1a5759
Remove use_legacy_workflow from the S3 backend configuration (#1730)
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2024-06-17 13:33:10 -04:00
Alex Ott
7e1a02cbb8
Make persist interval for remote state backend configurable (#1591)
Signed-off-by: Alex Ott <alexott@gmail.com>
Co-authored-by: Siddhartha Sonker <158144589+siddharthasonker95@users.noreply.github.com>
2024-05-28 13:47:16 -04:00
Oleksii Prudkyi
6ec06c86f5
gcs backend: fix race condition on locking (#1342)
Signed-off-by: Oleksii Prudkyi <Oleksii.Prudkyi@gmail.com>
2024-05-23 09:57:02 -04:00
Caleb Van Dyke
bffb968c1f
ensure authorization header is included for http backends (#1657)
Signed-off-by: CalebTVanDyke <ctvandyke24@gmail.com>
2024-05-20 18:03:56 +02:00
Christian Mesh
08469452b6
Fix inmem backend crash due to missing struct field (#1619)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-05-07 09:09:14 -04:00
Mikhail Mazurskiy
52eb928e6a
HTTP backend client cleanup (#1455)
Signed-off-by: Mikhail Mazurskiy <mmazurskiy@gitlab.com>
2024-04-25 11:31:54 -04:00
1garo
d869923103
Review and order locked struct fields (#1493)
Signed-off-by: 1garo <alevardai427@gmail.com>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
2024-04-25 10:25:13 -04:00
David Sims
1f3db74281
HTTP backend user-defined headers (#1487)
Signed-off-by: David Sims <simsdj82@gmail.com>
2024-04-16 14:45:56 +02:00
alwayshang
fd3736bd99
chore: fix repetitive words (#1472)
Signed-off-by: alwayshang <zhanghonghao@outlook.com>
2024-04-07 13:48:13 +02:00
Oleksandr Levchenkov
02e12d054e
ignore AccessDenied error on listing workspaces in S3 (#1445)
Signed-off-by: ollevche <ollevche@gmail.com>
2024-03-29 14:08:34 +02:00
Christian Mesh
8abb707c90
Improve panic handling within go-routines (#1425)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-03-26 07:41:16 -04:00
Oleksandr Levchenkov
739a66a86c
fix panic when encryption enabled for remote and cloud backends (#1431)
Signed-off-by: ollevche <ollevche@gmail.com>
2024-03-25 20:42:18 +02:00
Christian Mesh
230fc89a28
GCP KMS for Key Provider for Encryption (#1392)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-03-18 15:54:20 -04:00
Christian Mesh
07a9185767
Initial implementation of aws_kms encryption.key_provider (#1349)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Co-authored-by: James Humphries <james@james-humphries.co.uk>
2024-03-13 13:19:20 -04:00
Christian Mesh
586c45fe5a
Refactor encryption configuration (#1387)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-03-13 10:58:52 -04:00
Christian Mesh
5ab6167bbf
Initial wiring of encryption through the command package (#1316)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-03-07 08:55:57 -05:00
Christian Mesh
2f5dcd5c0a
Integrate Encryption into State Backends (#1288)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-03-04 09:25:14 -05:00
Christian Mesh
ac3ed86617
Integrate encryption into plan serialization (#1292)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-03-04 09:00:29 -05: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
James Humphries
199ec898e6
Resolve more inconsistencies in 32-bit systems (#1214)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
Co-authored-by: Isaac Parker <parrotmac@gmail.com>
2024-02-02 13:46:38 +00:00
Dmitry Kisler
7d73f2bbe6
Refactor tests to follow a safer way of setting envvars (#1215)
Signed-off-by: Dmitry Kisler <admin@dkisler.com>
2024-01-31 11:25:02 +01:00
Joshua Shanks
4961996f51
Ignore version conflicts when unlocking state (#1123)
Signed-off-by: Joshua Shanks <jjshanks@gmail.com>
Signed-off-by: Kuba Martin <kubam@spacelift.io>
Co-authored-by: Kuba Martin <kubam@spacelift.io>
2024-01-17 12:02:27 +01:00