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

(TF-18673) Validate Stack and Deployment files for unreferenced origins #1797

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

jpogran
Copy link
Contributor

@jpogran jpogran commented Aug 15, 2024

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.

@jpogran jpogran self-assigned this Aug 15, 2024
@jpogran jpogran force-pushed the stack_reference_validation branch 4 times, most recently from 27cf468 to b8fbee7 Compare August 16, 2024 15:08
@jpogran jpogran marked this pull request as ready for review August 16, 2024 15:09
@jpogran jpogran requested a review from a team as a code owner August 16, 2024 15:09
@jpogran jpogran changed the title Validate Stack and Deployment files for unreferenced origins (TF-18673) Validate Stack and Deployment files for unreferenced origins Aug 16, 2024
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.
@jpogran jpogran force-pushed the stack_reference_validation branch from b8fbee7 to 7ca3541 Compare August 16, 2024 15:29
Copy link
Member

@ansgarm ansgarm left a comment

Choose a reason for hiding this comment

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

Nice work! Test drove it and it works for the most parts – the only thing I thought would work but didn't was a reference to a component with a name that doesn't exist:
image
(^ this could and should fail)

…ferenced outputs that don't match the type constraint for where they're used
@ansgarm ansgarm merged commit 8d33e73 into pre-release Aug 19, 2024
6 checks passed
@ansgarm ansgarm deleted the stack_reference_validation branch August 19, 2024 14:58
jpogran added a commit that referenced this pull request Aug 30, 2024
…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>
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 Sep 19, 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