-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Random (and incorrect) error messages when validating "nested object" variables. #27010
Comments
Hi @mkielar, thanks for reporting this! I was able to reproduce with your config on versions of Terraform from 0.12.29 to 0.14.0-rc1. The randomness of the error message moving around makes me suspect that there's something related to map iteration in the diagnostic presentation, but I'd have to investigate further to be sure. |
I believe the issue is in go-cty's |
There's an upstream PR which fixes this here: zclconf/go-cty#78 |
Just noting that I saw this as well (also on |
Faced same issue with randomly spawned error about wrong attribute type with object. |
As I noted above, this bug is fixed upstream, and we expect the upstream library version to be released shortly. We'll have the fix rolled out with Terraform 0.14.1. Thanks for your patience! |
thank you @alisdair . For me, it's just weird that no one reported that for previous versions... |
I have
This line is a problem? |
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. |
Terraform Version
Terraform Configuration Files
variables.tf
:variables-general.auto.tfvars
:Debug Output
Output is random.
Sometimes, I get this (correct error message):
Sometimes I get this (incorrect error message):
Crash Output
N/A
Expected Behavior
The error message should consistently be:
Actual Behavior
The error message is pretty random. In real scenario I had around 20 different attributes like
foo
andbar
in the example, and I the errors I was getting were pointing to different attribute on that level quite randomly, sometimes pointing that two attributes on the root level are missing. I have also never observed a correct error message in real use-case, only creating this SSCCE allowed me to - sometimes - see the correct error message.Steps to Reproduce
Each of the below fails
terraform plan
terraform console
tflint
version0.20.3
also returned random errors, from which I suspect the bug is in some kind of a shared library between the two.Additional Context
This issue makes it quite hard to spot what's actually wrong, especially that with large structures (as mentioned, I had more that 20 other attributes in the
config
structure) the correct error message is very rarely displayed (I never got the correct message it in around 50 tries). I've just spent over an hour tracking a silly typo. I'd say it's quite important thing to fix in bothterraform
andtflint
.References
The text was updated successfully, but these errors were encountered: