-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Datasources silently return success on 404s when they should throw errors #12873
Comments
@rileykarson The request #14701 has been closed because it is against the solution strategy. However, what alternative do we have in order not to block the process for this normal use case ? |
I'm not sure, unfortunately! HashiCorp may have guidance on how to accomplish this. Returning an error when not found is- to our knowledge- the correct contract for datasources, and one we don't currently follow consistently. |
closed with GoogleCloudPlatform/magic-modules#8858 This will release with v5.0.0. Check #15582 for more details on the major release. |
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
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Not specific to a given core or provider version. I reproduced with:
Affected Resource(s)
data.google_*
resources, verified withdata.google_container_cluster
Terraform Configuration Files
Debug Output
https://gist.github.com/rileykarson/29dc7cde1d6f6eed3953432a95f6cdb8
Panic Output
N/A
Expected Behavior
An error should be returned to the user
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
We reuse Read functions between resources and their corresponding datasources. That means on a
404
error we set the resource id to""
. In a resource, that means that the resource doesn't exist. However in a datasource, it's meaningless. This manifests as Terraform believing it was successful in retrieving results for a datasource even though it's entirely null, as the underlying GET call failed. These differences are explained in theRead
function documentation:References
The text was updated successfully, but these errors were encountered: