Loading...
Loading...
After raising this [issue](https://github.com/hashicorp/terraform/issues/23231) I started to replace all my empty tuples with `toset([])`. While doing that I found out that there was a configuration in my code where an empty tuple doesn't throw an error. That's the code: ```hcl resource "random_string" "random" { for_each = var.test != null ? var.test : [] length = 16 } variable "test" { type = set(string) default = null } ``` The strange thing is that I got a configuration which is almost the same but throws the right error. The setup is something like that: ```hcl resource "random_string" "random" { for_each = var.test != null ? var.test.list : [] length = 16 } variable "test" { type = object({ list = set(string) string = string }) default = null } ``` In both cases I don't pass in any value for the test variable, `var.test` will be null and the for_each should get an empty tuple from the condition. ### Terraform Version <!--- Run `terraform -v` to show the version, and paste the result between the ``` marks below. If you are not running the latest version of Terraform, please try upgrading because your issue may have already been fixed. --> ``` Terraform v0.12.13 + provider.random v2.2.1 ``` ### Terraform Configuration Files <!-- Paste the relevant parts of your Terraform configuration between the ``` marks below. For large Terraform configs, please use a service like Dropbox and share a link to the ZIP file. For security, you can also encrypt the files using our GPG public key. --> ```hcl resource "random_string" "random" { for_each = var.test != null ? var.test : [] length = 16 } variable "test" { type = set(string) default = null } ``` ### Expected Behavior <!-- What should have happened? --> Terraform should throw an error because of the empty tuple. ### Actual Behavior <!-- What actually happened? --> The code is running without any problems. ### Steps to Reproduce <!-- Please list the full steps required to reproduce the issue, for example: 1. `terraform init` 2. `terraform apply` --> 1. `terraform init` 2. `terraform apply`
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.