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

Support multiple validation blocks during completion for variable block #609

Closed
seandockery opened this issue Aug 4, 2021 · 4 comments · Fixed by #610
Closed

Support multiple validation blocks during completion for variable block #609

seandockery opened this issue Aug 4, 2021 · 4 comments · Fixed by #610
Labels
bug Something isn't working

Comments

@seandockery
Copy link

The variable block can accept multiple validation blocks in terraform files. However, after I declare a validation block inside a variable block, completion in vscode does not offer validation again in the same variable block. I can work around the issue by deleting other validation blocks temporarily, but it would be nice if that wasn't necessary. I am using v2.14.0 of the HashiCorp Terraform extension. Thanks!

@seandockery
Copy link
Author

I imagine that this issue is in the wrong project, that the rule of there being a maximum of 1 validation block under a variable block is probably somewhere else. If you can guide me to the right project, I'll post an issue there.

@radeksimko radeksimko transferred this issue from hashicorp/vscode-terraform Aug 4, 2021
@radeksimko radeksimko added the bug Something isn't working label Aug 4, 2021
@radeksimko
Copy link
Member

Good catch - thank you for the report @seandockery

You are right indeed that multiple validation blocks are allowed/expected:
https://github.com/hashicorp/terraform/blob/d35bc0531255b496beb5d932f185cbcdb2d61a99/internal/configs/named_values.go#L132-L138

and you're also right about the place where this can be fixed. 😄

I just patched it upstream and raised #610

Additionally this fact also doesn't seem very obvious from the docs here:
https://www.terraform.io/docs/language/values/variables.html#custom-validation-rules
so I submitted a patch for these docs too: hashicorp/terraform#29299

@github-actions
Copy link

github-actions bot commented Sep 4, 2021

I'm going to lock this issue 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 similar to this, 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 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants