Commit graph

421 commits

Author SHA1 Message Date
Daniel Schmidt
a2a8697558
add test case for variable validation
Some checks failed
Quick Checks / Unit Tests (push) Has been cancelled
Quick Checks / Race Tests (push) Has been cancelled
Quick Checks / End-to-end Tests (push) Has been cancelled
Quick Checks / Code Consistency Checks (push) Has been cancelled
2026-02-11 13:03:15 +01:00
Daniel Schmidt
d813ad14f7 add deprecation marks 2026-02-03 13:32:06 +01:00
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
James Pogran
2c075b9f8e
Add component registry source resolution support to Terraform Stacks (#37888)
* Add component registry source resolution support to Terraform Stacks

This change implements the missing component source resolution case in the stack configuration loader, enabling Terraform Stacks to properly handle component registry sources from HCP Terraform and other component registries.

The implementation mirrors the existing module registry resolution workflow, where component sources are first resolved to their versioned form using the source bundle's component metadata, then converted to final source addresses that can be used to locate the actual component code. This completes the integration between the terraform-registry-address component parsing capabilities and the go-slug sourcebundle component resolution APIs.

* chore: bump go-slug to v0.18.1

* fix: add case for component final source type

* chore: rm space

* chore: sync module deps

* chore: update testdata with separate bundle

* fix: manifest file json obj with trailing comma

* Add changelog entry to 1.14

---------

Co-authored-by: Michael Yocca <michael.yocca@hashicorp.com>
2025-12-10 09:16:03 -05: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
Sarah French
2e5b5dee5d
Upgrade protoc and protoc-gen-go-grpc versions to matching terraform-plugin-go (#37647)
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
* Update protoc version in downloader script

* go get google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1

This matched terraform-plugin-go

* make protobuf

* Run `make protobuf`

* Update generator to handle generic types from google.golang.org/grpc

Looks like this was added in v1.69.3 in https://github.com/grpc/grpc-go/pull/7057 ?

* Run `make generate`

* Fix "cannot infer Res" compile error - more usage of generics

* More fixing compile errors due to switching to use of a generic

* Make putting `google.golang.org/grpc` import into generated files conditional

* Run `make generate`

* Update more places where generics now need to be used

* Update generator to handle any types from google.golang.org/grpc in same switch case.
2025-10-22 14:46:18 +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
1cb7d1859f
Merge pull request #37515 from hashicorp/jbardin/generate-config
provider GenerateResourceConfig
2025-09-05 16:31:23 -04:00
Sarah French
8503c45013
Update backend.Backend's StateMgr method to return diagnostics instead of primitive errors (#37496)
* Fix S3 backend test affected by making the Workspaces method return errors via diagnostics

* Address diagnostics comparison issues in test by ensuring expected diagnostics are defined in the context of the config they're triggered by

* Fix failing test case `TestBackendConfig_EC2MetadataEndpoint/envvar_invalid_mode` by making `diagnosticBase` struct comparable

* Add compile-time checks that diagnostic types fulfil interfaces

* Stop diagnosticBase implementing ComparableDiagnostic, re-add S3-specific comparer code to s3 package

* Update tests to use the S3-specific comparer again

* Fix test case missed in refactoring

* Update the backend.Backend interface to use diagnostics as return value from StateMgr method

* Fix calls to `Fatalf`
2025-09-04 11:14:35 +01: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
James Bardin
7ed24d208a make protobuf 2025-08-12 14:05:10 -04: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
Sarah French
7199fbd2bb
Update use of testChdir to standard library's t.Chdir, remove testChdir function from codebase (#37334)
* Replace use of `testChdir` with `t.Chdir`

* Update tests to use temporary directories with copied content, instead of using directories in the repo directly.

* Remove stacks copy of testChdir function

This has been replaced with t.Chdir from the standard library

* Replace remaining simple usage of testChdir

* Update guidance for using `tempWorkingDir`

* Replace use of testChdir in a function reused in a single test

* Update comments to no longer recommend using testChdir

* Remove testChdir function!
2025-07-16 16:04:10 +01:00
Sarah French
15840b3eae
Replace use of defer with t.Cleanup in majority of command package tests, update testChdir to work with t.Cleanup (#37326)
* Replace use of `defer` with `t.Cleanup` in tests

* Fix test failures by making cleanup function permissive of the temp dir being already deleted.
2025-07-16 10:24:56 +01: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
UKEME BASSEY
87e6f51fd9 fix test 2025-04-30 11:33:09 -04:00
UKEME BASSEY
5880479a0f break dependency of stack migrate on command Meta to prevent import cycles 2025-04-29 11:57:10 -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
96e50f680f
stacks: ensure consistent sources between removed blocks (#36915) 2025-04-24 10:24:20 +02: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