-
Notifications
You must be signed in to change notification settings - Fork 10.3k
query: add -query flag to validate command #37671
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3c752e9
query: propagate graph node removal to descendants
dsa0x 89875bd
validate all resource when validating lists
dsa0x 99d38bf
more tests, parse test files like expected
dsa0x c3614b9
unable to get output to pass validate and produce plan error
dsa0x 6b39ec2
fix skipped test
dsa0x 03877a0
more cleanup
dsa0x 1e84497
update graph_builder_apply.go
dsa0x 6a8f3d2
walk from list resource targets
dsa0x d1e0ee1
keep managed resource nodes in the path of list resources
dsa0x 5f5b2e4
query: add -query flag to validate command
dsa0x 0f6f3d8
Merge remote-tracking branch 'origin/main' into sams/validate-query-c…
dsa0x ba92fc9
add changelog
dsa0x f4bd337
query: generate unique resource identifiers for results of expanded l…
dsa0x c133049
Update internal/command/validate.go
dsa0x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| kind: ENHANCEMENTS | ||
| body: "query: support offline validation of query files via -query flag in the validate command" | ||
| time: 2025-09-25T15:12:37.198573+02:00 | ||
| custom: | ||
| Issue: "37671" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| terraform { | ||
| required_providers { | ||
| test = { | ||
| source = "hashicorp/test" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "test" {} |
21 changes: 21 additions & 0 deletions
21
internal/command/testdata/query/invalid-traversal/main.tfquery.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| variable "input" { | ||
| type = string | ||
| default = "foo" | ||
| } | ||
|
|
||
| list "test_instance" "test" { | ||
| provider = test | ||
|
|
||
| config { | ||
| ami = var.input | ||
| } | ||
| } | ||
|
|
||
| list "test_instance" "test2" { | ||
| provider = test | ||
|
|
||
| config { | ||
| // this traversal is invalid for a list resource | ||
| ami = list.test_instance.test.state.instance_type | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.