Commit graph

353 commits

Author SHA1 Message Date
Daniel Schmidt
4b34066cf2 add error to Pre and PostDiff hook
We need this information for stacks to forward the error to the progress
stream as stacks expects everything that reports itself starting to e.g. plan
to also finish either in an error or with success.
2026-01-30 16:13:59 +01:00
Daniel Schmidt
f4c22be3c5 stacks: send progress events on failed provider configurations 2026-01-30 16:13:59 +01:00
Daniel Schmidt
b926263c03 stacks: follow component progress cycle for empty destroys
Some checks failed
build / Build for freebsd_amd64 (push) Has been cancelled
build / Build for linux_amd64 (push) Has been cancelled
build / Build for openbsd_amd64 (push) Has been cancelled
build / Build for solaris_amd64 (push) Has been cancelled
build / Build for windows_amd64 (push) Has been cancelled
build / Build for freebsd_arm (push) Has been cancelled
build / Build for linux_arm (push) Has been cancelled
build / Build for darwin_arm64 (push) Has been cancelled
build / Build for linux_arm64 (push) Has been cancelled
build / Build for windows_arm64 (push) Has been cancelled
build / Build Docker image for linux_386 (push) Has been cancelled
build / Build Docker image for linux_amd64 (push) Has been cancelled
build / Build Docker image for linux_arm (push) Has been cancelled
build / Build Docker image for linux_arm64 (push) Has been cancelled
build / Build e2etest for linux_386 (push) Has been cancelled
build / Build e2etest for windows_386 (push) Has been cancelled
build / Build e2etest for darwin_amd64 (push) Has been cancelled
build / Build e2etest for linux_amd64 (push) Has been cancelled
build / Build e2etest for windows_amd64 (push) Has been cancelled
build / Build e2etest for linux_arm (push) Has been cancelled
build / Build e2etest for darwin_arm64 (push) Has been cancelled
build / Build e2etest for linux_arm64 (push) Has been cancelled
build / Run e2e test for linux_386 (push) Has been cancelled
build / Run e2e test for windows_386 (push) Has been cancelled
build / Run e2e test for darwin_amd64 (push) Has been cancelled
build / Run e2e test for linux_amd64 (push) Has been cancelled
build / Run e2e test for windows_amd64 (push) Has been cancelled
build / Run e2e test for linux_arm (push) Has been cancelled
build / Run e2e test for linux_arm64 (push) Has been cancelled
build / Run terraform-exec test for linux amd64 (push) Has been cancelled
We expect a component instances to report its plan/apply starting and ending as
well as reporting the progress / result. This should also be the case for no-ops
like an empty component instance.
2026-01-15 14:23:02 +01:00
Nick Fagerlund
b2aad914f1
stacks: Make path.module and path.root relative, to match documentation (#37982)
Some checks failed
build / Build for freebsd_amd64 (push) Has been cancelled
build / Build for linux_amd64 (push) Has been cancelled
build / Build for openbsd_amd64 (push) Has been cancelled
build / Build for solaris_amd64 (push) Has been cancelled
build / Build for windows_amd64 (push) Has been cancelled
build / Build for freebsd_arm (push) Has been cancelled
build / Build for linux_arm (push) Has been cancelled
build / Build for darwin_arm64 (push) Has been cancelled
build / Build for linux_arm64 (push) Has been cancelled
build / Build for windows_arm64 (push) Has been cancelled
build / Build Docker image for linux_386 (push) Has been cancelled
build / Build Docker image for linux_amd64 (push) Has been cancelled
build / Build Docker image for linux_arm (push) Has been cancelled
build / Build Docker image for linux_arm64 (push) Has been cancelled
build / Build e2etest for linux_386 (push) Has been cancelled
build / Build e2etest for windows_386 (push) Has been cancelled
build / Build e2etest for darwin_amd64 (push) Has been cancelled
build / Build e2etest for linux_amd64 (push) Has been cancelled
build / Build e2etest for windows_amd64 (push) Has been cancelled
build / Build e2etest for linux_arm (push) Has been cancelled
build / Build e2etest for darwin_arm64 (push) Has been cancelled
build / Build e2etest for linux_arm64 (push) Has been cancelled
build / Run e2e test for linux_386 (push) Has been cancelled
build / Run e2e test for windows_386 (push) Has been cancelled
build / Run e2e test for darwin_amd64 (push) Has been cancelled
build / Run e2e test for linux_amd64 (push) Has been cancelled
build / Run e2e test for windows_amd64 (push) Has been cancelled
build / Run e2e test for linux_arm (push) Has been cancelled
build / Run e2e test for linux_arm64 (push) Has been cancelled
build / Run terraform-exec test for linux amd64 (push) Has been cancelled
* stacks: Make path.module and path.root relative, to match documentation

Previously, we were just handing off the absolute path produced by the
sourcebundle struct. But that's no good, because the value doesn't stay
consistent between plan and apply when running under tfc-agent. (It uses working
directories named after the unique job ID.) It also doesn't match the
documentation, which describes these as relative paths. This was preventing
people from uploading module-provided files to create aws lambda functions, for
example.

This commit addresses that by converting the source-bundle provided module path
to a relative path (relative to Terraform's working directory). In tfc-agent for
stacks runs, that ends up being the directory directly above the sourcebundle
directory, and all the paths below that are consistent between plan and apply.

* I think this is how the changelog thing works?
2025-12-12 11:05:32 -08:00
Matej Risek
768b7bd0bc Add local values walk to walk_dynamic
This helps us catch diagnostics in locals that only happen during evaluation

Co-authored-by: Mutahhir Hayat <mutahhir.hayat@hashicorp.com>
Co-authored-by: Matej Risek <matej.risek@hashicorp.com>
2025-12-11 10:42:52 +01:00
Liam Cervante
7ac2b7938e
Stacks: temporarily disable ephemeral outputs in Stack components (#37823) 2025-10-31 09:52:48 +01:00
Liam Cervante
411f18e6ac
ephemerals: allow root ephemeral outputs in stacks and test (#37813)
* ephemerals: allow root ephemeral outputs in stacks and test

* remember to set new opt for apply stage
2025-10-28 09:29:44 +01:00
Daniel Schmidt
2714cfde69 standardize on marks.Has
Some checks are pending
build / Build for windows_amd64 (push) Blocked by required conditions
build / Build for freebsd_arm (push) Blocked by required conditions
build / Build for linux_arm (push) Blocked by required conditions
build / Build for darwin_arm64 (push) Blocked by required conditions
build / Build for linux_arm64 (push) Blocked by required conditions
build / Build for windows_arm64 (push) Blocked by required conditions
build / Build Docker image for linux_386 (push) Blocked by required conditions
build / Build Docker image for linux_amd64 (push) Blocked by required conditions
build / Build Docker image for linux_arm (push) Blocked by required conditions
build / Build Docker image for linux_arm64 (push) Blocked by required conditions
build / Build e2etest for linux_386 (push) Blocked by required conditions
build / Build e2etest for windows_386 (push) Blocked by required conditions
build / Build e2etest for darwin_amd64 (push) Blocked by required conditions
build / Build e2etest for linux_amd64 (push) Blocked by required conditions
build / Build e2etest for windows_amd64 (push) Blocked by required conditions
build / Build e2etest for linux_arm (push) Blocked by required conditions
build / Build e2etest for darwin_arm64 (push) Blocked by required conditions
build / Build e2etest for linux_arm64 (push) Blocked by required conditions
build / Run e2e test for linux_386 (push) Blocked by required conditions
build / Run e2e test for windows_386 (push) Blocked by required conditions
build / Run e2e test for darwin_amd64 (push) Blocked by required conditions
build / Run e2e test for linux_amd64 (push) Blocked by required conditions
build / Run e2e test for windows_amd64 (push) Blocked by required conditions
build / Run e2e test for linux_arm (push) Blocked by required conditions
build / Run e2e test for linux_arm64 (push) Blocked by required conditions
build / Run terraform-exec test for linux amd64 (push) Blocked by required conditions
Quick Checks / Unit Tests (push) Waiting to run
Quick Checks / Race Tests (push) Waiting to run
Quick Checks / End-to-end Tests (push) Waiting to run
Quick Checks / Code Consistency Checks (push) Waiting to run
2025-10-09 14:48:13 +02:00
Radek Simko
922fdb2382
Implement LockState & UnlockState provider methods (#37711) 2025-10-03 10:02:02 +01:00
Radek Simko
51fc4c161f
PSS: Implement ReadStateBytes + WriteStateBytes (#37440)
* Implement ReadStateBytes + WriteStateBytes

* [WIP] -  Testing ReadStateBytes and WriteStateBytes (#37464)

* Fix nil pointer error

* Add WIP test for ReadStateBytes

* Move test mock to separate testing file

* Update mock to send unexpected EOF when there's a problem returning data and it's not a true EOF

* Add test case for when length != expected length

* Add test for when trying to read state from a store type that doesn't exist

* Change symbol names to lowercase

* Add ability to force a diagnostic to be returned from `mockReadStateBytesClient`'s `Recv` method

* Add test showing error diagnostics raised by the ReadStateBytes client are returned

* Add missing header

* Simplify mock by using an embedded type

* Rename `mockOpts` to `mockReadStateBytesOpts`

* Update existing tests to assert what arguments are passed to the RPC method call

* Add mock WriteStateBytesClient which uses `go.uber.org/mock/gomock` to enable assertions about calls to Send

* Add a test for WriteStateBytes that makes assertions about calls to the Send method

* Update test case to explicitly test writing data smaller than the chunk size

* Implement chunking in WriteStateBytes, add test case to assert expected chunking behaviour

* Add generated mock for Provider_WriteStateBytesClient in protocol v6

* Update tests to use new `MockProvider_WriteStateBytesClient`, remove handwritten mock

* Update code comments in test

* Add tests for diagnostics and errors returned during WriteStateBytes

* Add generated mock for Provider_ReadStateBytesClient in protocol v6, replace old mock

* Add test case for grpc errors in ReadStateBytes, fix how error is returned

* Typo in comment

* Add missing warning test, rename some test cases

* Update proto file definition of Read/WriteStateBytes RPCs (#37529)

* Update Read/WriteStateBytes RPCs to match https://github.com/hashicorp/terraform-plugin-go/pull/531

* Run `make protobuf`

* Run `make generate`

* Update use of `proto.ReadStateBytes_ResponseChunk` in tests

* Fix how diagnostics are handled alongside EOF error, update ReadStateBytes test

* More fixes - test setup was incorrect

I think? I assume that a response would be returned full of zero-values when EOF is encountered.

* WIP - avoid crash if chunk is nil

* Sarah's updates to radek/pss-read-write (#37642)

* Update code to not expect a chunk when EOF encountered

* Return early if any grpc errors are encountered during ReadStateBytes

* Close the stream with CloseSend once everything's read without error. Add test case about handling grpc errors from CloseSend.

* Fix test case about warnings: We would expect to receive a chunk with data alongside the warning and have a normal closing of the stream after EOF

* Add log line, remove unneeded type info

* Implement configurable state chunk size

* handle metadata in WriteStateBytes correctly

* validate chunk sizes received from provider

* ReadStateBytes: avoid early return on warnings

---------

Co-authored-by: Sarah French <15078782+SarahFrench@users.noreply.github.com>
2025-09-26 17:03:02 +01:00
Liam Cervante
15a6cd208b
stacks: fix diagnostic referring to tfstacks command (#37639) 2025-09-19 10:22:03 +02:00
Liam Cervante
0b15151513
stacks: remove support for deprecated .tfstack extension (#37617)
* stacks: remove support for deprecated .tfstack extension

* also remove from comments and readme
2025-09-16 13:20:07 +02:00
James Bardin
88d64326d3 stacks stubs 2025-08-29 15:00:30 -04:00
Liam Cervante
abf1c00e03
stacks migrate: make diagnostics more relevant to operation (#37416) 2025-08-25 10:10:21 +02:00
Kristin Laemmert
0374f04424
Add ValidateActionConfig to provider interface, protocol & internal implementations (#37345)
* Add ValidateActionConfig to provider interface and protocol

* Update internal/provider-simple-v6/provider.go

Co-authored-by: Daniel Schmidt <danielmschmidt92@gmail.com>

---------

Co-authored-by: Daniel Schmidt <danielmschmidt92@gmail.com>
2025-07-18 14:14:44 -04:00
Daniel Schmidt
688a1f9955 add todo 2025-07-10 16:06:44 +02:00
Daniel Schmidt
ac132d1b15 add provider implementation for actions 2025-07-10 16:06:44 +02:00
Liam Cervante
2a1b4c3ed4
Update go-cty and HCL for 1.13 release (#37298) 2025-07-09 13:05:18 +02:00
Sarah French
0f8e77a50f
PSS: Add GetStates and DeleteState RPCs to plugin protocol v6 (#37288)
* Add GetStates RPC method to Plugin Protocol v6

* Add DeleteState RPC method to Plugin Protocol v6

* Add methods to provider-simple

* Fix error messages

* Apply suggestions from code review

Co-authored-by: Radek Simko <radeksimko@users.noreply.github.com>

* Change how GetStates RPC returns the list of state names

* Change GetStates implementation to use new data type

* `make protobuf` to accommodate new code comments

---------

Co-authored-by: Radek Simko <radeksimko@users.noreply.github.com>
2025-07-07 10:40:45 +01:00
Matej Risek
a9b67a6cdc
stacks: Don't require built-in providers to be listed under required providers. (#37234) 2025-06-18 17:02:27 +02:00
Daniel Banck
cb58a15f3d
Implement ListResource RPC (TF-25509) (#37092)
* Implement ListResource RPC via callbacks

* Implement ListResource with iterators

* Change `ListResourceResponse` to slice

* Turn ListResourceResponse into a struct

* Add a limit for ListResource

* explicitly cancel stream when listing resources

---------

Co-authored-by: Samsondeen Dare <samsondeen.dare@hashicorp.com>
2025-06-04 09:40:10 +02:00
Radek Simko
643266dc90
Add initial state store protocol skeleton (#37197)
* Add initial state store protocol skeleton

Introduce ValidateStateStoreConfig + ConfigureStateStore
Update GetProviderSchema + GetMetadata (for mux)

* address PR feedback
2025-06-03 13:52:35 +00:00
Daniel Banck
44ae7da18e
Update Plugin Protocol for List and Implement ValidateListResourceConfig (#37007)
* Minor auto-formatting changes

* Add list RPC and schema protobuf definitions

* make protobuf

* make generate

* Add ValidateListResourceConfig implementation
2025-05-19 10:20:52 +02:00
Liam Cervante
b6be635748
stacks migrate: allow resource mapping to include nested resources (#37060)
* stacks migrate: allow resource mapping to include nested resources

* make protobuf
2025-05-16 10:10:47 +02:00
Liam Cervante
3d4391865d
stacks: skip resource instance hooks during refresh plans (#37043)
* stacks: skip resource instance hooks during refresh plans

* add copywrite headers
2025-05-15 06:41:38 +00:00
Liam Cervante
a80220dcc9
stacks: rename .tfstack files to .tfcomponent (#37013)
* stacks: rename .tfstack files to .tfcomponent

* fix consistency issues
2025-05-15 08:33:13 +02:00
James Bardin
807e084130 final renaming for function results 2025-05-08 11:42:05 -04:00
James Bardin
a6ec17cb77 rename function results table
Remove "provider" from the function results fields since it's not going
to be exclusively used for providers any longer.
2025-05-07 16:03:43 -04:00
James Bardin
d016070564 move function results hashing to lang
We need to abstract the function results verification to use internally
too, so start by moving it out of the providers code.
2025-05-07 13:02:46 -04:00
Liam Cervante
1bc7d22ac4
stacks: removed blocks should refresh during refresh plans (#36916)
* stacks: removed blocks should refresh during refresh plans

* fix copywrite headers

* clarify return values of DefinedByStackInstance
2025-04-24 08:52:26 +00:00
Liam Cervante
dcff9e4d2c
stacks: improve test coverage for removed blocks (#36914)
* stacks: improve test coverage for removed blocks

* remove leftover comment
2025-04-24 09:22:50 +02:00
Liam Cervante
4eaa9d7fa0
stacks: removing embedded stacks should ignore stacks not in state (#36901) 2025-04-24 08:56:11 +02:00
Liam Cervante
063757ff45
stacks: refactor plan, state, and removed tracking with tree structures for efficient lookups (#36850) 2025-04-16 14:05:51 +02:00
Samsondeen
be242c36f4
Stacks migrate: migration workflow improvements (#36882) 2025-04-16 08:51:18 +02:00
Liam Cervante
a06f82746a
stacks: update removed blocks to allow targeting of embedded stacks (#36814)
* stacks: update removed blocks to allow targeting of embedded stacks

* copywrite headers
2025-04-04 15:01:37 +02:00
Liam Cervante
2b5101f734
stacks: include existing components when deferring nested stacks (#36788)
* stacks: include existing components when deferring nested stacks

* improve comments
2025-04-03 10:40:28 +02:00
Liam Cervante
fbd5a7930e
stacks: allow removed blocks to target components in nested stacks (#36787)
* stacks: allow removed blocks to target components in nested stacks

* make copywrite fix

* fix comments
2025-04-03 10:29:18 +02:00
Liam Cervante
7fadbe34de
write-only attributes: internal providers should set write-only attributes to null (#36824)
* write-only attributes: internal providers should set write-only attributes to null

* add changelog

* fix copywrite headers
2025-04-02 15:58:42 +02:00
Liam Cervante
c8044baf47
stacks: emit state updates for unclaimed components (#36702)
* stacks: allow multiple removed blocks to target the same component

* make linter happy

* stacks: emit state updates for unclaimed components
2025-04-02 08:39:10 +02:00
Liam Cervante
9707a27ee6
stacks: rename Removed to RemovedComponent in stackeval (#36782)
* stacks: provide stack and config on component creation

* stacks: rename Removed to RemovedComponent in stackeval

* renamed function calls also
2025-04-01 07:08:02 +00:00
Liam Cervante
7bec38bf5f
stacks: provide stack and config on component creation (#36778) 2025-04-01 08:34:05 +02:00
Liam Cervante
ebdf52cd09
stacks: remove all the unnecessary ctx function parameters (#36762)
* stacks: remove all the unnecessary ctx function parameters

* fix missing context
2025-03-26 12:34:23 +00:00
Liam Cervante
f82ae44484
stacks: make promises identify themselves (#36749)
* stacks: refactor promises so they declare id when starting

* stacks: add some missing perEval promises

* formatting
2025-03-26 13:25:45 +01:00
Samsondeen
71dbc7d726
migrate command for terraform stacks (#36482) 2025-03-19 10:39:50 +01:00
Samsondeen
8b7e7ad27d
Detect circular references during Validation (#36709) 2025-03-19 10:39:23 +01:00
Liam Cervante
9bbe34daa4
stacks: pre-destroy refresh should use a normal plan (#36696)
* stacks: pre-destroy refresh should use a normal plan

* format
2025-03-18 09:28:31 +01:00
Liam Cervante
c16d466773
stacks: allow multiple removed blocks to target the same component (#36693)
* stacks: allow multiple removed blocks to target the same component

* make linter happy
2025-03-18 08:54:27 +01:00
Daniel Schmidt
bc901abcc5 stacks: test resource identity 2025-03-12 14:46:50 +01:00
Liam Cervante
d4d92ea0b9
Fix broken build due to merge conflicts (#36679) 2025-03-12 09:47:07 +00:00
Liam Cervante
3d014d82f3
stacks: fix errors processing index keys of removed blocks (#36673) 2025-03-12 10:33:18 +01:00