Default context timeouts for v2 SDK CRUD operaitons

I read through the SDK code and found a defaut 20 minute context timeout, is that accurate for all CRUD operations? Or is it a different default for each op?

It is global for all CRUD operations: terraform-plugin-sdk/resource_data.go at v2.7.0 · hashicorp/terraform-plugin-sdk · GitHub

You can define per-operation, per-resource defaults for your timeouts: Resources - Retries and Customizable Timeouts - Terraform by HashiCorp

1 Like

Thanks @paddy!

I think this page Resources - Retries and Customizable Timeouts - Terraform by HashiCorp should be updated to reflect the nuance of using the v2 SDK with Context aware CRUD functions. With Context CRUDs, there is already this 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 Terraform for VULTR restoration bugs out after ~20 min waiting for resource to be active #29320 · Issue #159 · vultr/terraform-provider-vultr · GitHub 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.

Yeah, we definitely should write this up somewhere, and the workaround to disable it. Any chance you’d like to open an issue for that?

Sure. What repo does this doc live in?

You could either put it in hashicorp/terraform-website or in hashicorp/terraform-plugin-sdk. I think either option is equally reasonable, honestly.

Thanks for the replies @paddy! Opened docs/extend/resources/retries-and-customizable-timeouts.html: Update to explain nuance when using SDK v2 Context CRUD functions · Issue #1809 · hashicorp/terraform-website · GitHub.

1 Like