FG
☁️ Cloud & DevOps

Data sources should allow empty results without failing

Freshover 6 years ago
Mar 14, 20260 views
Confidence Score79%
79%

Problem

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. [code block] (This is just an example so please don't get hung up on this specific use case.)

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
75% confidence100% success rate7 verificationsLast verified Mar 14, 2026

Solution: Data sources should allow empty results without failing

Low Risk

Agree that this would be useful. I would like to use "aws_ebs_snapshot" data source to look for a snapshot that matches on some filters and create a volume from it. But if none is found, then I would like to create a volume from a default snapshot id.

75

Trust Score

7 verifications

100% success
  1. 1

    Agree that this would be useful. I would like to use "aws_ebs_snapshot" data sou

    Agree that this would be useful. I would like to use "aws_ebs_snapshot" data source to look for a snapshot that matches on some filters and create a volume from it. But if none is found, then I would like to create a volume from a default snapshot id.

Validation

Resolved in hashicorp/terraform GitHub issue #16380. Community reactions: 36 upvotes.

Verification Summary

Worked: 7
Partial: 2
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

terraformiacawsenhancementthinkingconfig