Open wyardley opened 2 months ago
Thank you for raising this feature request.
We probably can't just use the current evaluator and parser as is because the test language has different semantics than the Terraform language. We would need to implement a dedicated emulator stack for the test language, which would require a fairly large refactoring.
See also https://github.com/terraform-linters/tflint/issues/1949
A lot of the things can be parsed as-is, since the assertions are used in things like validation conditions. Even though there are some new fields possibly, I get at least some value (list index style for example) simply by renaming the files, and don’t notice any errors from the attributes that maybe tflint
doesn’t know about.
https://developer.hashicorp.com/terraform/language/tests/mocking
.tfmock.hcl
and .tfmock.json
-- two more test specific files
Summary
It sounds from #2030 like
tftest.hcl
files should be able to be linted.It seems, however, as if tflint may not be parsing
*.tftest.hcl
files (it should also recurse into subdirectories when in recursive mode if there are directories with no.tf
files but with.tftest.hcl
files).Taking a look at the code, including here, seems like some adjustments and tests might be needed for this to work?
In the example below, if the file is renamed to
.tf
,tflint
will correctly flaggoogle_storage_bucket.foo.bar.0.main_page_suffix
vsgoogle_storage_bucket.foo.bar[0].main_page_suffix
being used.Terraform Configuration