Commit graph

25 commits

Author SHA1 Message Date
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
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
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
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
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
063757ff45
stacks: refactor plan, state, and removed tracking with tree structures for efficient lookups (#36850) 2025-04-16 14:05:51 +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
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
Samsondeen
71dbc7d726
migrate command for terraform stacks (#36482) 2025-03-19 10:39:50 +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
Liam Cervante
3d014d82f3
stacks: fix errors processing index keys of removed blocks (#36673) 2025-03-12 10:33:18 +01:00
Liam Cervante
36971f6ee8
stacks: add support for the removed block to .tfstacks.hcl (#35669) 2024-09-05 12:22:16 +02:00
Liam Cervante
5939efb798
stacks: add depends_on for embedded stacks and components (#35549) 2024-08-12 15:02:36 +02:00
Martin Atkins
8c36d3b580 stackconfig: Variables and outputs can be sensitive/ephemeral
This should eventually have the same meaning as it does for the modules
language under the ephemeral_values language experiment, but as of this
commit is just accepted during decoding and then ignored. The rest of the
functionality will follow in subsequent commits.

There's no specific experiment guard in this case because the stack
configuration language is already experimental as a whole anyway.
2024-06-17 08:34:46 -07:00
Sebastian Rivera
015f795ff0 Rebrand Terraform Cloud to HCP Terraform 2024-04-23 16:12:59 -04:00
Martin Atkins
3f569b55c5 stacks: Some code consistency cleanups in preparation for first merge 2023-11-15 12:38:57 -08:00
Martin Atkins
13edd30479 stackeval: Test-only globals
Because many stacks language features are dependent on others to do useful
work, it's tempting to focus only on integration testing of combinations
of features used together. However, we known from our experience with the
modules runtime (the "terraform" package) that over time this becomes a
huge maintenance burden, because any non-trivial change tends to
invalidate hundreds or thousands of integration tests, and because of their
broad scope its often hard in retrospect to figure out what exactly a
particular test was aiming to test vs. what it was just relying on as a
side-effect.

To try to minimize these cross-dependencies and thus enable something
closer to unit testing, here we introduce a special kind of symbol to the
stacks language which is available only to unit tests in this package.
"Test-only globals" -- an intentionally-clunky name to avoid squatting on
useful names -- can be set as part of the Main object and, when defined,
are available for use in all situations where we perform expression
evaluation against a stack. The "globals" in the name represents that,
unlike just about everything else, they are defined once but available in
all stacks in the configuration tree.

This design is a tradeoff: it introduces a bunch of extra code that is
here entirely to support testing, but hopefully this code is segregated
enough from everything else that it's unlikely to change significantly
under future maintenance, thereby hopefully minimizing the need for future
cross-cutting test maintenance too.
2023-11-15 12:38:56 -08:00
Martin Atkins
9ccca7acc0 stackconfig: Add HashiCorp copyright comments 2023-11-15 12:38:55 -08:00
Martin Atkins
c1e7abafc3 stackruntime: Configure and assign provider instances
Instead of the temporary hack of hard-coding the built-in "terraform"
provider, it's now possible to declare configurations for arbitrary
providers and assign them to the provider configuration slots of the root
module of each component.
2023-11-15 12:38:54 -08:00
Martin Atkins
3dc3781904 stackruntime: Starting up and configuring provider plugins
Each declared provider configuration is now started up and configured
during planning. We don't actually do anything with them yet other than
shut them down again once the plan is complete, but we'll improve on that
in subsequent commits.
2023-11-15 12:38:54 -08:00
Martin Atkins
d435cd5a1b stackconfig: Bring the source bundle with the config
When we load stackconfig we don't immediately load any of the modules that
component blocks refer to, so we need to bring the source bundle along
with the configuration so that a downstream piece of code (the stack
language runtime, currently) can load those from the same source bundle.
2023-11-15 12:38:52 -08:00
Martin Atkins
9b78be9024 stacks/stackconfig: Hoist "typeexpr" out of the "internal" directory
Previously we placed "typeexpr" under "internal" to represent that it
wasn't for use by other parts of Terraform, but that was too strict: the
Stacks runtime needs to be able to import this package to access the
Defaults API.

For now we'll make it importable by the whole of Terraform. However, in
a later commit we might wish to establish an internal subdirectory directly
under "stacks" for packages that are only for stacks-related functionality,
since this "typeexpr" contains Stacks-specific logic and the rest of
Terraform ought to be using HCL's own "typeexpr" package instead.
2023-11-15 12:38:52 -08:00
Martin Atkins
41d931d21a stackconfig: Initial HCL decoding logic
This is a first pass for decoding the new stack configuration language,
which is overall pretty similar to the Terraform module language but does
have some intentional differences both in its top-level concepts -- has
embedded stacks and components instead of nested modules and resources --
and in its details, where we're making use of some learnings about where
folks have struggled with the Terraform module language.

This initial implementation should be enough for us to experiment with but
we'll probably iterate on this more in later commits as we learn from
implementing a language runtime for this and from actually trying to use
the language for real use-cases.
2023-11-15 12:38:51 -08:00
Martin Atkins
c11edd0cd8 stacks/stackconfig: Initial stubbing of Stacks language objects 2023-11-15 12:38:50 -08:00