I currently have this map in a test.tfvars file:
ssm = {
names = ["Terraform-1","Terraform-2","Terraform-3"]
values = ["tf-1","tf-2","tf-3"]
}
And what I want to do is the following:
resource "aws_ssm_parameter" "parameter_store" {
count = 3
name = "$${element(var.ssm[names],count.index)}"
type = "String"
value = "$${element(var.ssm[values],count.index)}"
}
But instead of count=3, I would like the count to be based off of the length of the names list from my ssm map. I've tried this:
"${length(var.ssm[names])}"
But I'm getting the error:
Error: aws_ssm_parameter.parameter_store: resource count can't reference variable: names
Can anyone point me in the right direction with solving this error? I'm not too sure what I'm doing wrong.
name = "${element(var.ssm[names],count.index)}"
– ydaetskcoR