-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Allow data sources searching tags/filters to return empty results #8302
Comments
Looks like hashicorp/terraform#16380 is probably a blocker for implementing this. |
This issue should be addressed. If I use the the AWS SDK, I get an empty list returned, versus 404 or empty response. Something is returned and terraform should respect that response instead of generating an error. Coding standards have progressed along with the AWS API. This should not throw an error.
|
The same goes for aws_ebs_snapshot. I want to be able to specify "create an ebs volume based on this latest snapshot, but if no snapshot exists create an empty ebs volume." |
We need to consider whether or not this would be a breaking change. |
We have now documented in our Provider Design documentation that plural data sources should return zero, one, or multiple results without error. Singular data sources should still return an error when the remote component is not found. We can go back through any non-conformant plural data sources to fix them up, but this might want to wait until our next major release since it is a behavior change for the existing cases. I'm going to mark it with that milestone for tracking for now, but it might be done sooner depending on some further investigation work to determine if it was previously possible to rely on the error in configurations (e.g. with |
This functionality has been released in v4.0.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Description
There are use-cases for data sources such as
aws_vpcs
oraws_security_groups
that do not return results based on the tags/filter. If there are not results, these data sources will error out during the planning stage. Having a flag that allowed these data sources to return empty lists could expand their usage to search for resources that might not exist yet, but could in future runs.New or Affected Resource(s)
Potential Terraform Configuration
References
The text was updated successfully, but these errors were encountered: