Hi,
How can I dynamically create a resource based on a passed variable which is not a simple “true/false” boolean?
For example this pseudo-code:
resource "something" {
if var.day != Sunday
...
}
Hi,
How can I dynamically create a resource based on a passed variable which is not a simple “true/false” boolean?
For example this pseudo-code:
resource "something" {
if var.day != Sunday
...
}
The standard idiom is:
resource "some_thing" "blue" {
count = var.day != "Sunday" ? 1 : 0
}
Something to watch out for - once you do this, you have to change any references elsewhere in your Terraform code to some_thing.blue
to some_thing.blue[0]
.