How can I handle the following where the variables var can be null
locals {
tf_variables = (var.variables == null) ? null : jsondecode(var.variables)["variables"]
}
resource "tfe_variable" "this" {
for_each = local.tf_variables
...
}
I'm hitting
Error: Invalid for_each argument
on ..\..\main.tf line 63, in resource "tfe_variable" "this":
63: for_each = local.tf_variables
The given "for_each" argument value is unsuitable: the given "for_each"
argument value is null. A map, or set of strings is allowed.