This is an enhancement request. Data sources should allow empty results without failing the plan or apply. This would allow for fallback or fallthrough scenarios that are needed in certain situations. An optional allow_empty_result attribute on the data source would support many use cases where a datasource value is not explicitly required. The specific attribute name isn't important to me.
As an example, the configuration below currently fails because the aws_ami datasource will not find any results. However I still want the apply to continue using a fallback AMI.
data "aws_ami" "main" {
most_recent = true
filter {
name = "name"
values = ["blah-blah"]
}
}
output "ami" {
value = "${coalesce(data.aws_ami.main.id,"ami-abc-123")}"
}
(This is just an example so please don't get hung up on this specific use case.)
This is an enhancement request. Data sources should allow empty results without failing the plan or apply. This would allow for fallback or fallthrough scenarios that are needed in certain situations. An optional
allow_empty_resultattribute on the data source would support many use cases where a datasource value is not explicitly required. The specific attribute name isn't important to me.As an example, the configuration below currently fails because the
aws_amidatasource will not find any results. However I still want the apply to continue using a fallback AMI.(This is just an example so please don't get hung up on this specific use case.)