Loading...
Loading...
### Terraform Version ```shell Terraform v1.13.3 on darwin_arm64 ``` ### Terraform Configuration Files module/main.tf: ```terraform variable "value" { type = bool } output "value" { value = var.value } ``` module/tests/basic.tftest.hcl: ```terraform run "test1" { assert { condition = output.value == true error_message = "exptected value to be true" } } run "test2" { variables { value = !var.value } assert { condition = output.value == false error_message = "expected value to be false" } } ``` module/tests/tests.auto.tfvars: ```ini value = true ``` ### Debug Output ``` ...debug output, or link to a gist... ``` ### Expected Behavior ```shell tests/basic.tftest.hcl... in progress run "test1"... pass run "test2"... pass tests/basic.tftest.hcl... tearing down tests/basic.tftest.hcl... pass Success! 2 passed, 0 failed. ``` ### Actual Behavior ```shell tests/basic.tftest.hcl... in progress run "test1"... pass run "test2"... pass ╷ │ Warning: Variable referenced without definition │ │ on tests/basic.tftest.hcl line 10, in run "test2": │ 10: value = !var.value │ │ Variable "value" was referenced without providing a definition. Referencing undefined variables within Terraform Test files is deprecated, please add a `variable` block into the relevant test file to provide a definition for the │ variable. This will become required in future versions of Terraform. ╵ tests/basic.tftest.hcl... tearing down tests/basic.tftest.hcl... pass Success! 2 passed, 0 failed. ``` ### Steps to Reproduce 1. `terraform init` 2. `terraform test` ### Additional Context I'm assuming it should be possible to provide the initial value for a variable using either a `*.tfvars` file or as an environmental variable and later override this value in a run a block. ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.