Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Stacks (merge pre-release to main) #1833

Merged
merged 32 commits into from
Sep 23, 2024
Merged

Add Stacks (merge pre-release to main) #1833

merged 32 commits into from
Sep 23, 2024

Conversation

ansgarm
Copy link
Member

@ansgarm ansgarm commented Sep 23, 2024

jpogran and others added 30 commits September 23, 2024 16:55
This commit adds a job to load the metadata for a stack. This metadata is used to decode the some of the configuration early before we have all the information we need to decode the full configuration. This is a first step towards decoding the full configuration of a stack.
…les (#1763)

* feat: load embedded provider schemas for providers found in stacks file while early decoding
* Bump terraform-schema to `4ae973d1`
This change adds a new job to load the component sources of a stack after parsing the stack metadata. For a component with a module source, the job will trigger a `did_open` event for the Modules feature to handle. This will allow the Modules feature to load the module and its dependencies, leading to eventually being able to complete Module references.

This only handles local modules at the moment. Remote modules are not supported yet.
…allow jobs to wait for kicked-off events to settle

Use this new functionality in LoadStackComponentSources to allow waiting for parsing local modules used in stacks
components before other jobs run that need the parsing results
* chore: make provider schema available to schema merger
* refactor: move PreloadEmbeddedSchema job into Defer as future jobs in Defer will depend on it
* feat: make module meta available in schema merger
* chore: add changie entry
* fix: combine readers into one, address review feedback
* refactor: continue parsing if loading stack component sources failed
* Bump terraform-schema to `9fc1ce5`
* fix: add missing fields to Copy()
* feat: use deployment schema merger
* Bump terraform-schema to `de25956`
* chore: add changie entry
This change enables early validation for Terraform Stacks in tfstack. hcl and tfdeploy.hcl files.

Available validations:

- Missing required attributes
- Deprecated attributes
- Deprecated blocks
- Unexpected attributes
- Unexpected blocks
- Maximum number of blocks
- Minimum number of blocks
- Block labels length

This adds a new job to validate the schema of the these files. The job is enqueued when the `EnableEnhancedValidation` option is set to true.
TODO: Revist checking Stack concepts in the static validators

Other validators are more generic and can be applied to any block/attribute/etc, but this one is specific to the stack block types. I'm sure this could be done in a more generic way, but I'm not sure if it's worth it at the moment.

The names of these blocks are used as identifiers in the stack and are used in the UI, so they have to be valid Terraform identifiers or else the stack will not be able to be created. This is a very basic check to ensure that the names are valid until we can do more advanced checks or use the cloud api.

I tried adding this to the earlydecoder, but we do not seem to report the diagnostics there at all currently, so nothing was being reported. I'm not sure if that's a bug or intended.
…#1786)

* Add DecodeReferenceOrigins and DecodeReferenceTargets jobs

This commit adds two new jobs, DecodeReferenceOrigins and DecodeReferenceTargets, and their supporting plumbing to the stacks feature. These jobs are responsible for collecting reference origins and targets, respectively. Reference origins and targets are used to determine where a reference is defined and where it is used.

This information is useful for features like go-to-definition and go-to-references.
…me (#1791)

* fix: fix panic on blocks with no labels during validation of label name

* chore: add changie entry
…ces (#1794)

* Rename SchemaForModule to SchemaForStack
* Bump terraform-schema to `8191b5e`

---------

Co-authored-by: Ansgar Mertens <ansgar@hashicorp.com>
…1799)

* feat: support a subset of functions in deployment configs
)

* feat: support storing early decoded deploy config

* chore: add changie entry

* Bump terraform-schema to `27f3526`
…ns (#1797)

* Validate Stack and Deployment files for unreferenced origins

This commit adds a new validation to check for unreferenced origins in stack and deployment files. This validation is performed after the reference targets and origins are decoded.

The validation checks for references to variables and local values that do not have a corresponding target. The validation is performed for variables, local values, providers and identity_tokens only, as components can have unknown schema.

* refactor: stop validating components as we see false positives for referenced outputs that don't match the type constraint for where they're used

---------

Co-authored-by: Ansgar Mertens <ansgar@hashicorp.com>
* Bump terraform-schema to `1800e4c`

* chore: add changie entries
* Bump terraform-schema to `1800e4c`

* chore: add changie entries

* Stage 0.35.0-beta1
* feat: Support provider defined functions in stacks

* chore: add changie entry

* Bump terraform-schema to `4f99bab`
* Document Terraform Stacks support
…ks in deployment configuration (#1813)

* feat: Support context references within orchestrate blocks in deployment configuration

* chore: add changie entry

* Bump terraform-schema to `c383931`

* refactor: simplify code
* chore: add stacks Terraform version to telemetry
* chore: add changie entry
@ansgarm ansgarm requested a review from a team as a code owner September 23, 2024 15:10
@ansgarm ansgarm changed the title pre release Add Stacks (merge pre-release to main) Sep 23, 2024
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ansgarm ansgarm merged commit 571f327 into main Sep 23, 2024
45 checks passed
@ansgarm ansgarm deleted the pre-release branch September 23, 2024 15:32
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants