Terraform Data with No Results

In general data sources will fail if the resource being requested doesn’t exist. They are expected to be used to reference resources that are not managed by Terraform (or by a different Terraform root module/state).

It sounds like you are wanting to have Terraform create a resource unless the resource already exists. This isn’t something you can do. What you can do is pass in a flag (e.g. via a variable) to decide if you want to create the resource or use an existing one. Alternatively if the resource exists and you want it to be managed by Terraform look at terraform import.