I have a few regions that each have remote state stored in them, and a few regions that lack that remote state. I’m trying to figure out a way to ignore the regions that lack that remote state, but I either get:
Error: Invalid count argument
on bla.tf line 59, in resource "aws_security_group" "SG":
59: count = length(lookup(data.terraform_remote_state.bla[0].outputs, "bla_bla", [])) > 0 ? 1 : 0
The "count" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be created.
To work around this, use the -target argument to first apply only the
resources that the count depends on.
or
Error: Unable to find remote state
on bla.tf line 8, in data "terraform_remote_state" "bla_bla":
8: data "terraform_remote_state" "bla_bla" {
No stored state was found for the given workspace in the given backend.
Is there a reason why defaults
doesn’t allow me to skip remote states that don’t exist?