Terraform: how to read list of maps?
The trick here is to use the dictionary syntax to replace the element call, it behaves better with lists of maps.
value = "${lookup(data.aws_kms_secrets.api_key.*.plaintext[count.index], "secret_name")}"
its tempting to do data.aws_kms_secrets.api_key[count.index].plaintext
that isn't valid HCL