i’m using version 0.14.8. any idea on how to get the aws_ami datasource to dynamically filter with a list or map? this is what i have below but does not work.
variable “filter-tags” {
type = map
}
data “aws_ami” “db_ami” {
most_recent = true
owners = [“self”]
dynamic “filter” {
for_each = var.filter-tags
content {
name = tag.key
values = tag.value
}
}
terraform plan
Error: Invalid value for module argument
on main.tf line 38, in module “ec2_cluster”:
38: filter-tags = {
39: “tag:os” = [“ubuntu”]
40: “tag:release” = [“bionic”]
41: “tag:Team” = [“dba”]
42: “tag:purpose” = [“goodpurpose”]
43: }
The given value is not suitable for child module variable “filter-tags”
defined at …/…/…/modules/services/elastic-cluster/variables.tf:142,1-23:
element “tag:release”: string required.