-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
Question about Invalid value for variable because of a validation rule. #718
Comments
How do you provide value to this variable now? Because in current setup |
Actually I don't provide any value, as it is a Terraform module. Later I will use this module with Terragrunt and provide values. |
That's interesting, as we have similar validation options in module and never faced such errors. Whatever, try https://github.com/antonbabenko/pre-commit-terraform?tab=readme-ov-file#all-hooks-set-env-vars-inside-hook-at-runtime https://developer.hashicorp.com/terraform/language/values/variables#environment-variables |
Well, I just try with these options and it doesn't work. I have the same error message
Actually, I have a monorepo for all my TF modules. May be, that's the problem. Here is the tree
|
It's every directory with Terraform code is "module". Terraform can't figure out when it is child module and when it is root module 🤷🏻
It's best to tf validate your TF code, especially when you develop TF modules.
@MaxymVlasov We allow only uppercase vars: https://github.com/antonbabenko/pre-commit-terraform/blob/master/hooks/_common.sh#L131 |
Interestingly, that I haven't faced such issues too 🤔 TS might be having some bit of setup that we don't know of... ps: |
Thanks for your help. I use a And I need to refactor all my regex, they seem not really working. |
Quick update. So the main problem is, well are my regex. They seem to overcomplicated for TF. |
Beware that I only guesstimated what your intent was re the regex. |
Hello everyone,
I test the pre-commit hook for Terraform with terraform_validate. And I have this error Error: Invalid value for variable because of This was checked by the validation rule for var.publisher_name.
The files are in a directory that will be used as a Terraform module.
Error message
In the main.tf
And in the variables.tf
The resource will be used later as a module and the variable publisher_name will be required.
So is it possible to use mock data or may be there is another processs or method to avoid this kind of error ?
Thanks for your help.
David
The text was updated successfully, but these errors were encountered: