You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.
Description
Currently, if we're using data source google_storage_bucket_object on a file that does not exist, the terraform plan exits with a 404 error. Could it be possible that we let this call return a null value, or something we can exploit in order to conditionally do things in the plan?
For better understanding, here's my usecase: I have a cloud function on GCP, its code is send via gsutil on our CI/CD platform, but I still want to provision this cloud function with terraform. I'd like to check if the source code of this function is present in the bucket. If not, I'd like to be able to skip the creation of the cloud function.
What's being asked for here is the opposite of intended behaviour for datasources nowadays, see #12873. At the time of this issue getting filed the behaviour was undefined, and we weren't sure what was best. Since then, datasources implicitly returning nulls has proven to cause hard-to-diagnose issues for customers, and the behaviour of the GCS object resource is consistent with current practices.
Additionally, given the evolving stance of the Terraform Core team at HashiCorp in hashicorp/terraform#16380 (comment) (and in numerous updates since then!), I don't believe kind of conditional configuration is an intended use case.
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.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
Description
Currently, if we're using data source
google_storage_bucket_object
on a file that does not exist, the terraform plan exits with a 404 error. Could it be possible that we let this call return a null value, or something we can exploit in order to conditionally do things in the plan?For better understanding, here's my usecase: I have a cloud function on GCP, its code is send via
gsutil
on our CI/CD platform, but I still want to provision this cloud function with terraform. I'd like to check if the source code of this function is present in the bucket. If not, I'd like to be able to skip the creation of the cloud function.New or Affected Resource(s)
Potential Terraform Configuration
References
The text was updated successfully, but these errors were encountered: