magodo / terraform-provider-restful

Terraform provider to manage RESTful resources
https://registry.terraform.io/providers/magodo/restful
Mozilla Public License 2.0
16 stars 5 forks source link

Moving the `retry(_xxx)` blocks from `restful_resource` and `restful_operation` to the provider `retry` block, with simplification #112

Closed magodo closed 3 months ago

magodo commented 3 months ago

74 is the initial ask for adding the retry logic in the client. Unfortunately, #75 is implemented with issues that have unbound concurrent modifications to the same client in different operations. E.g. https://github.com/magodo/terraform-provider-restful/blob/c71e2c4ff05fa25e728791da9cf28b049a4ef0f1/internal/client/client.go#L189-L190

This provider shares a singleton resty client, which means all the retry logic added applies to that same client. So this PR removes the resource bound retry options, instead move it to the provider block, under client attribute. The schema is similar to before, except that the status and status_locator is now simply merged into status_codes (list of number), which meets most regular usage of the client level retry (including #74).

State migration is also provided for a smooth upgrade.