docs/extend/resources/retries-and-customizable-timeouts.html: Update to explain nuance when using SDK v2 Context CRUD functions
CyrusJavan opened this issue · 3 comments
I think this page should be updated to reflect the nuance of using the v2 SDK with Context aware CRUD functions. With Context CRUDs, there is already a default 20 minute timeout so the setting for resource.StateChangeConf.Timeout will not be respected if it is greater than 20 minutes. You can see this confusion in the wild here (vultr/terraform-provider-vultr#159) where a provider developer thought their resource.StateChangeConf.Timeout of 60 minutes was being respected, but actually the 20 minute timeout would always be hit first.
Excellent suggestion. Real briefly -- two additional options in this case:
- Using
(helper/schema.ResourceData).Timeout()
to fetch the associated resource timeout to set retry timeouts within the resource logic (note that it is recommended to set logic timeouts below resource timeouts to avoid the confusingcontext: deadline exceeded
error) - Use the
(Create|Read|Update|Delete)WithoutTimeout
fields onhelper/schema.Resource
instead of(Create|Read|Update|Delete)Context
which bypasses setting a resource-level timeout and foregoes the disconnect between the two timeouts
Hi All, I'm going to mark this as "Backlog" for now until it can be planned in. I know it's been added to the engineering backlog. Just wanted to provide this update and let you know why I'm adding the label. We can follow up here and close out this ticket once it's been addressed. Thank you!
Hi @CyrusJavan 👋 Thank you for raising this. Updates have been posted to https://www.terraform.io/docs/extend/resources/retries-and-customizable-timeouts.html which should now clarify the default behaviors across the CRUD functions and offer more appropriate recommendations. Please reach out if there is anything else!