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

Implement unreferenced variable validation #1357

Merged
merged 15 commits into from
Aug 18, 2023

Conversation

jpogran
Copy link
Contributor

@jpogran jpogran commented Aug 10, 2023

Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.

Original ticket: hashicorp/hcl-lang#288

Needs hashicorp/hcl-lang#302

@jpogran jpogran self-assigned this Aug 10, 2023
@jpogran jpogran force-pushed the f-early-validation-hook branch from 6399262 to 36dee47 Compare August 10, 2023 18:45
Add the ability to use the collected origin and target references in early validation.

Validation funcs will be provided by terraform-ls for now.
@jpogran jpogran force-pushed the reference_validation branch from d702109 to 89142aa Compare August 10, 2023 18:46
@jpogran jpogran force-pushed the reference_validation branch from 06eefbd to 85d39dd Compare August 15, 2023 16:36
Signed-off-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
@jpogran jpogran changed the title reference validation Implement reference validation Aug 16, 2023
@jpogran jpogran marked this pull request as ready for review August 16, 2023 15:34
@jpogran jpogran requested a review from a team as a code owner August 16, 2023 15:34
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Mostly LGTM aside from my in-line comments. I expect we will find a few other cases of references which are reliable enough to report on - e.g. locals but that can be a subject of another future PR!

btw. I expect that once hashicorp/hcl-lang#302 is merged, this PR can also bump hcl-lang as a dependency.

internal/decoder/validations/unreferenced_origin.go Outdated Show resolved Hide resolved
internal/decoder/validations/unreferenced_origin.go Outdated Show resolved Hide resolved
internal/decoder/validations/unreferenced_origin.go Outdated Show resolved Hide resolved
internal/decoder/validations/unreferenced_origin.go Outdated Show resolved Hide resolved
internal/decoder/validations/unreferenced_origin.go Outdated Show resolved Hide resolved
internal/decoder/validations/unreferenced_origin_test.go Outdated Show resolved Hide resolved
jpogran and others added 4 commits August 16, 2023 14:04
@jpogran jpogran changed the title Implement reference validation Implement unreferenced variable validation Aug 16, 2023
@jpogran jpogran merged this pull request into f-early-validation-hook Aug 18, 2023
@jpogran jpogran deleted the reference_validation branch August 18, 2023 16:19
dbanck pushed a commit that referenced this pull request Aug 22, 2023
Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.
dbanck added a commit that referenced this pull request Aug 24, 2023
* Implement unreferenced variable validation (#1357)

Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.

* Introduce ValidationDiagnostics field to module

* Publish early validation diagnostics

* Include validation diagnotics in changes check

* Introduce early validation job

* Check ValidationDiagnosticsState when running validation

* Run early validation job after collection jobs

* Bump hcl-lang to `b6a3f8`

* Update internal/terraform/module/module_ops.go

Co-authored-by: Radek Simko <radek.simko@gmail.com>

---------

Co-authored-by: James Pogran <jpogran@outlook.com>
Co-authored-by: Radek Simko <radek.simko@gmail.com>
dbanck added a commit that referenced this pull request Aug 29, 2023
* Implement unreferenced variable validation (#1357)

Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.

* Introduce ValidationDiagnostics field to module

* Publish early validation diagnostics

* Include validation diagnotics in changes check

* Introduce early validation job

* Check ValidationDiagnosticsState when running validation

* Run early validation job after collection jobs

* Bump hcl-lang to `b6a3f8`

* Update internal/terraform/module/module_ops.go

Co-authored-by: Radek Simko <radek.simko@gmail.com>

---------

Co-authored-by: James Pogran <jpogran@outlook.com>
Co-authored-by: Radek Simko <radek.simko@gmail.com>
dbanck added a commit that referenced this pull request Aug 31, 2023
* Implement unreferenced variable validation (#1357)

Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.

* Introduce ValidationDiagnostics field to module

* Publish early validation diagnostics

* Include validation diagnotics in changes check

* Introduce early validation job

* Check ValidationDiagnosticsState when running validation

* Run early validation job after collection jobs

* Bump hcl-lang to `b6a3f8`

* Update internal/terraform/module/module_ops.go

Co-authored-by: Radek Simko <radek.simko@gmail.com>

---------

Co-authored-by: James Pogran <jpogran@outlook.com>
Co-authored-by: Radek Simko <radek.simko@gmail.com>
radeksimko added a commit that referenced this pull request Sep 4, 2023
* Implement unreferenced variable validation (#1357)

Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.

* Introduce ValidationDiagnostics field to module

* Publish early validation diagnostics

* Include validation diagnotics in changes check

* Introduce early validation job

* Check ValidationDiagnosticsState when running validation

* Run early validation job after collection jobs

* Bump hcl-lang to `b6a3f8`

* Update internal/terraform/module/module_ops.go

Co-authored-by: Radek Simko <radek.simko@gmail.com>

---------

Co-authored-by: James Pogran <jpogran@outlook.com>
Co-authored-by: Radek Simko <radek.simko@gmail.com>
dbanck added a commit that referenced this pull request Sep 7, 2023
* Implement unreferenced variable validation (#1357)

Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.

* Introduce ValidationDiagnostics field to module

* Publish early validation diagnostics

* Include validation diagnotics in changes check

* Introduce early validation job

* Check ValidationDiagnosticsState when running validation

* Run early validation job after collection jobs

* Bump hcl-lang to `b6a3f8`

* Update internal/terraform/module/module_ops.go

Co-authored-by: Radek Simko <radek.simko@gmail.com>

---------

Co-authored-by: James Pogran <jpogran@outlook.com>
Co-authored-by: Radek Simko <radek.simko@gmail.com>
dbanck added a commit that referenced this pull request Sep 12, 2023
* Implement unreferenced variable validation (#1357)

Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.

* Introduce ValidationDiagnostics field to module

* Publish early validation diagnostics

* Include validation diagnotics in changes check

* Introduce early validation job

* Check ValidationDiagnosticsState when running validation

* Run early validation job after collection jobs

* Bump hcl-lang to `b6a3f8`

* Update internal/terraform/module/module_ops.go

Co-authored-by: Radek Simko <radek.simko@gmail.com>

---------

Co-authored-by: James Pogran <jpogran@outlook.com>
Co-authored-by: Radek Simko <radek.simko@gmail.com>
radeksimko added a commit that referenced this pull request Sep 13, 2023
* Implement unreferenced variable validation (#1357)

Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.

* Introduce ValidationDiagnostics field to module

* Publish early validation diagnostics

* Include validation diagnotics in changes check

* Introduce early validation job

* Check ValidationDiagnosticsState when running validation

* Run early validation job after collection jobs

* Bump hcl-lang to `b6a3f8`

* Update internal/terraform/module/module_ops.go

Co-authored-by: Radek Simko <radek.simko@gmail.com>

---------

Co-authored-by: James Pogran <jpogran@outlook.com>
Co-authored-by: Radek Simko <radek.simko@gmail.com>
@github-actions
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 18, 2023
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