resource "aws_cloudwatch_metric_alarm" "cpu_credit_balance_too_low" {
count = length(regexall("(t2|t3)", data.aws_db_instance.database.db_instance_class)) > 0 ? "1" : "0"
Error: Invalid count argument
on .terraform/modules/mymod.rds-alarms/main.tf line 28, in resource "aws_cloudwatch_metric_alarm" "cpu_credit_balance_too_low":
28: count = length(regexall("(t2|t3)", data.aws_db_instance.database.db_instance_class)) > 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.