hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.33k stars 1.73k forks source link

All resources should have configurable timeouts #3954

Open danawillow opened 5 years ago

danawillow commented 5 years ago

And we should get rid of the OperationWait() methods that don't have them so that we can guarantee across the codebase that we're using them.

Inspired by https://github.com/GoogleCloudPlatform/magic-modules/pull/2001, where a user caught a bug where one of our resources had a timeouts block declared, but it wasn't used everywhere, and so their timeouts didn't work. In the past, we could make the case that the user should check the docs to see which resources do and don't support timeouts, but it's harder to make now that we have so many resources that do, and so few that don't.

danawillow commented 4 years ago

The merged PR fixes most of these. Here's a list of resources which, according to their documentation, don't support timeouts (grep -rL 'Timeouts' website/docs/r/):

I didn't bother checking whether the docs+code matched. Also, no IAM resources support timeouts as far as I'm aware. Before doing IAM ones, we'd probably want to convert the eventual consistency checks into the framework introduced in https://github.com/terraform-providers/terraform-provider-google/issues/4993.

For resources with synchronous calls, we could add retry logic which takes a timeout. For extra credit, we could send a context with a timeout into the request that we send, though I think our synchronous calls tend to return quickly, so I don't think it would really be worth it.

grayside commented 3 years ago

I'm currently running into the lack of timeout support for google_storage_bucket_object, error seems like I need a larger timeout to support an archive upload.

My specific case could be mitigated by https://github.com/hashicorp/terraform-provider-archive/issues/62. I'm now stuck considering how to reimplement my archive handling because my upload bandwidth is constrained (or the error is obfuscating a deeper problem).

danawillow commented 3 years ago

Hey @grayside, you'll probably have better luck filing a new issue specifically for that resource :)