Skip to content

Commit 88219a4

Browse files
committed
feat: retryv2
1 parent 2caa155 commit 88219a4

File tree

302 files changed

+22691
-7571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+22691
-7571
lines changed

docs/data-sources/resource.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ output "quarantine_policy" {
108108
```
109109

110110
To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
111-
- `retry` (Attributes) The retry block supports the following arguments: (see [below for nested schema](#nestedatt--retry))
111+
- `retry` (Attributes) The retry object supports the following attributes: (see [below for nested schema](#nestedatt--retry))
112112
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
113113

114114
### Read-Only
@@ -136,14 +136,17 @@ To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
136136

137137
Required:
138138

139-
- `error_message_regex` (List of String) A list of regular expressions to match against error messages. If any of the regular expressions match, the error is considered retryable.
139+
- `error_message_regex` (List of String)
140140

141141
Optional:
142142

143143
- `interval_seconds` (Number) The base number of seconds to wait between retries. Default is `10`.
144144
- `max_interval_seconds` (Number) The maximum number of seconds to wait between retries. Default is `180`.
145145
- `multiplier` (Number) The multiplier to apply to the interval between retries. Default is `1.5`.
146146
- `randomization_factor` (Number) The randomization factor to apply to the interval between retries. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Therefore set to zero `0.0` for no randomization. Default is `0.5`.
147+
- `response_is_nil` (Boolean) If set to `true`, the retry will be triggered when the response is `nil`. Default is `true`.
148+
- `status_forbidden` (Boolean) If set to `true`, the retry will be triggered when the status code is `403`. Default is `true`.
149+
- `status_not_found` (Boolean) If set to `true`, the retry will be triggered when the status code is `404`. Default is `true`.
147150

148151

149152
<a id="nestedblock--timeouts"></a>

docs/data-sources/resource_action.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ data "azapi_resource_action" "example" {
8787
```
8888

8989
To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
90-
- `retry` (Attributes) The retry block supports the following arguments: (see [below for nested schema](#nestedatt--retry))
90+
- `retry` (Attributes) The retry object supports the following attributes: (see [below for nested schema](#nestedatt--retry))
9191
- `sensitive_response_export_values` (Dynamic) The attribute can accept either a list or a map.
9292

9393
- **List**: A list of paths that need to be exported from the response body. Setting it to `["*"]` will export the full response body. Here's an example. If it sets to `["properties.loginServer", "properties.policies.quarantinePolicy.status"]`, it will set the following HCL object to the computed property sensitive_output.
@@ -154,14 +154,17 @@ To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
154154

155155
Required:
156156

157-
- `error_message_regex` (List of String) A list of regular expressions to match against error messages. If any of the regular expressions match, the error is considered retryable.
157+
- `error_message_regex` (List of String)
158158

159159
Optional:
160160

161161
- `interval_seconds` (Number) The base number of seconds to wait between retries. Default is `10`.
162162
- `max_interval_seconds` (Number) The maximum number of seconds to wait between retries. Default is `180`.
163163
- `multiplier` (Number) The multiplier to apply to the interval between retries. Default is `1.5`.
164164
- `randomization_factor` (Number) The randomization factor to apply to the interval between retries. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Therefore set to zero `0.0` for no randomization. Default is `0.5`.
165+
- `response_is_nil` (Boolean) If set to `true`, the retry will be triggered when the response is `nil`. Default is `true`.
166+
- `status_forbidden` (Boolean) If set to `true`, the retry will be triggered when the status code is `403`. Default is `true`.
167+
- `status_not_found` (Boolean) If set to `true`, the retry will be triggered when the status code is `404`. Default is `true`.
165168

166169

167170
<a id="nestedblock--timeouts"></a>

docs/data-sources/resource_list.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ data "azapi_resource_list" "listSubnetsByVnet" {
113113
```
114114

115115
To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
116-
- `retry` (Attributes) The retry block supports the following arguments: (see [below for nested schema](#nestedatt--retry))
116+
- `retry` (Attributes) The retry object supports the following attributes: (see [below for nested schema](#nestedatt--retry))
117117
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
118118

119119
### Read-Only
@@ -138,14 +138,17 @@ To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
138138

139139
Required:
140140

141-
- `error_message_regex` (List of String) A list of regular expressions to match against error messages. If any of the regular expressions match, the error is considered retryable.
141+
- `error_message_regex` (List of String)
142142

143143
Optional:
144144

145145
- `interval_seconds` (Number) The base number of seconds to wait between retries. Default is `10`.
146146
- `max_interval_seconds` (Number) The maximum number of seconds to wait between retries. Default is `180`.
147147
- `multiplier` (Number) The multiplier to apply to the interval between retries. Default is `1.5`.
148148
- `randomization_factor` (Number) The randomization factor to apply to the interval between retries. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Therefore set to zero `0.0` for no randomization. Default is `0.5`.
149+
- `response_is_nil` (Boolean) If set to `true`, the retry will be triggered when the response is `nil`. Default is `true`.
150+
- `status_forbidden` (Boolean) If set to `true`, the retry will be triggered when the status code is `403`. Default is `true`.
151+
- `status_not_found` (Boolean) If set to `true`, the retry will be triggered when the status code is `404`. Default is `true`.
149152

150153

151154
<a id="nestedblock--timeouts"></a>

docs/ephemeral-resources/resource_action.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ ephemeral "azapi_resource_action" "listKeys" {
9898
```
9999

100100
To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
101-
- `retry` (Attributes) The retry block supports the following arguments: (see [below for nested schema](#nestedatt--retry))
101+
- `retry` (Attributes) The retry object supports the following attributes: (see [below for nested schema](#nestedatt--retry))
102102
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
103103

104104
### Read-Only
@@ -123,14 +123,17 @@ To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
123123

124124
Required:
125125

126-
- `error_message_regex` (List of String) A list of regular expressions to match against error messages. If any of the regular expressions match, the error is considered retryable.
126+
- `error_message_regex` (List of String)
127127

128128
Optional:
129129

130130
- `interval_seconds` (Number) The base number of seconds to wait between retries. Default is `10`.
131131
- `max_interval_seconds` (Number) The maximum number of seconds to wait between retries. Default is `180`.
132132
- `multiplier` (Number) The multiplier to apply to the interval between retries. Default is `1.5`.
133133
- `randomization_factor` (Number) The randomization factor to apply to the interval between retries. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Therefore set to zero `0.0` for no randomization. Default is `0.5`.
134+
- `response_is_nil` (Boolean) If set to `true`, the retry will be triggered when the response is `nil`. Default is `true`.
135+
- `status_forbidden` (Boolean) If set to `true`, the retry will be triggered when the status code is `403`. Default is `true`.
136+
- `status_not_found` (Boolean) If set to `true`, the retry will be triggered when the status code is `404`. Default is `true`.
134137

135138

136139
<a id="nestedblock--timeouts"></a>

docs/guides/retry-configuration.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
layout: "azapi"
3+
page_title: "Feature: Retry Configuration"
4+
description: |-
5+
This guide will describe how to configure the retry behavior in the AzAPI provider. The retry configuration allows you to control how the provider handles failed requests and if it should retry them.
6+
---
7+
8+
## Why retry?
9+
10+
Sometimes, when managing cloud infrastructure, requests to the cloud provider may fail due to transient issues such as network problems, timeouts, eventual consistency, or rate limiting. In these cases, it can be beneficial to retry the request a few times before giving up. The AzAPI provider allows you to configure the retry behavior to suit your needs.
11+
12+
## Retry configuration
13+
14+
There are two types of retry configurations available in the AzAPI provider:
15+
16+
1. Provider retry configuration
17+
2. Resource-specific retry configuration
18+
19+
### Provider retry configuration
20+
21+
The provider retry configuration is a global configuration that applies to all resources managed by the provider. You can configure the provider retry behavior by setting the following provider values:
22+
23+
- `go_sdk_maximum_retry_attempts`
24+
25+
This value controls the number of times the provider will retry a failed request. The default value is `3`.
26+
A retry will be triggered if the request fails with HTTP 408, 429, 500, 502, 503, or 504.
27+
28+
In the case that the response header contains a `Retry-After` value, the provider will wait for the specified duration before retrying the request.
29+
30+
### Resource-specific retry configuration
31+
32+
In addition to the provider retry configuration, you can also configure the retry behavior for individual resources. This allows you to fine-tune the retry behavior for specific resources.
33+
34+
The resource-specific retry comes after the provider retry, that is to say that the provider retry will be attempted first, and if it fails or exceeds the maximum attempts, the resource-specific retry will be attempted.
35+
Note that the resource-specific retry does not honour the `Retry-After` header and is exponential backoff based.
36+
37+
Resource specific retry is configured using the `retry` attribute.
38+
With `azapi_resource` and `azapi_data_plane_resource` resources, the provider performs a read after the resource has been created/updated to collect the read-only attributes of the resource. In this case there is a second retry attribute called `retry_read_after_create`, which controls the retry behavior of this operation.
39+
40+
If you configure a retry configuration, the maximum elapsed time for the retry will be set to the resource's timeout value for that operation (create, update, read, delete).
41+
42+
The schema of these retry attributes is as follows:
43+
44+
- `interval_seconds` - The initial number of seconds to wait before the 1st retry. The default value is `10`.
45+
- `max_interval_seconds` - The maximum number of times to retry the request. The default value is `180`.
46+
- `multiplier` - The multiplier to apply to the interval between retries. The default value is `1.5`.
47+
- `randomization_factor` - The randomization factor to apply to the interval between retries. The default value is `0.5`. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Set to zero `0.0` for no randomization.
48+
- `response_is_nil` - If the response is nil, should the request be retried. The default value is `true`.
49+
- `status_forbidden` - If the status code is 403, should the request be retried. The default value is `false`.
50+
- `status_not_found` - If the status code is 404, should the request be retried. The default value is `false`.

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ provider "azapi" {
7272
- `enable_preflight` (Boolean) Enable Preflight Validation. The default is false. When set to true, the provider will use Preflight to do static validation before really deploying a new resource. When set to false, the provider will disable this validation.
7373
- `endpoint` (Attributes List) The Azure API Endpoint Configuration. (see [below for nested schema](#nestedatt--endpoint))
7474
- `environment` (String) The Cloud Environment which should be used. Possible values are `public`, `usgovernment` and `china`. Defaults to `public`. This can also be sourced from the `ARM_ENVIRONMENT` Environment Variable.
75+
- `go_sdk_maximum_retry_attempts` (Number) The maximum number of retries to attempt if the Azure API returns an HTTP 408, 429, 500, 502, 503, or 504 response. The default is `3`.
7576
- `oidc_azure_service_connection_id` (String) The Azure Pipelines Service Connection ID to use for authentication. This can also be sourced from the `ARM_OIDC_AZURE_SERVICE_CONNECTION_ID` environment variable.
7677
- `oidc_request_token` (String) The bearer token for the request to the OIDC provider. This can also be sourced from the `ARM_OIDC_REQUEST_TOKEN` or `ACTIONS_ID_TOKEN_REQUEST_TOKEN` Environment Variables.
7778
- `oidc_request_url` (String) The URL for the OIDC provider from which to request an ID token. This can also be sourced from the `ARM_OIDC_REQUEST_URL` or `ACTIONS_ID_TOKEN_REQUEST_URL` Environment Variables.

docs/resources/data_plane_resource.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ resource "azapi_data_plane_resource" "example" {
137137
```
138138

139139
To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
140-
- `retry` (Attributes) The retry block supports the following arguments: (see [below for nested schema](#nestedatt--retry))
140+
- `retry` (Attributes) The retry object supports the following attributes: (see [below for nested schema](#nestedatt--retry))
141+
- `retry_read_after_create` (Attributes) The retry object supports the following attributes: (see [below for nested schema](#nestedatt--retry_read_after_create))
141142
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
142143
- `update_headers` (Map of String) A mapping of headers to be sent with the update request.
143144
- `update_query_parameters` (Map of List of String) A mapping of query parameters to be sent with the update request.
@@ -164,14 +165,35 @@ To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
164165

165166
Required:
166167

167-
- `error_message_regex` (List of String) A list of regular expressions to match against error messages. If any of the regular expressions match, the error is considered retryable.
168+
- `error_message_regex` (List of String)
168169

169170
Optional:
170171

171172
- `interval_seconds` (Number) The base number of seconds to wait between retries. Default is `10`.
172173
- `max_interval_seconds` (Number) The maximum number of seconds to wait between retries. Default is `180`.
173174
- `multiplier` (Number) The multiplier to apply to the interval between retries. Default is `1.5`.
174175
- `randomization_factor` (Number) The randomization factor to apply to the interval between retries. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Therefore set to zero `0.0` for no randomization. Default is `0.5`.
176+
- `response_is_nil` (Boolean) If set to `true`, the retry will be triggered when the response is `nil`. Default is `true`.
177+
- `status_forbidden` (Boolean) If set to `true`, the retry will be triggered when the status code is `403`. Default is `true`.
178+
- `status_not_found` (Boolean) If set to `true`, the retry will be triggered when the status code is `404`. Default is `true`.
179+
180+
181+
<a id="nestedatt--retry_read_after_create"></a>
182+
### Nested Schema for `retry_read_after_create`
183+
184+
Required:
185+
186+
- `error_message_regex` (List of String)
187+
188+
Optional:
189+
190+
- `interval_seconds` (Number) The base number of seconds to wait between retries. Default is `10`.
191+
- `max_interval_seconds` (Number) The maximum number of seconds to wait between retries. Default is `180`.
192+
- `multiplier` (Number) The multiplier to apply to the interval between retries. Default is `1.5`.
193+
- `randomization_factor` (Number) The randomization factor to apply to the interval between retries. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Therefore set to zero `0.0` for no randomization. Default is `0.5`.
194+
- `response_is_nil` (Boolean) If set to `true`, the retry will be triggered when the response is `nil`. Default is `true`.
195+
- `status_forbidden` (Boolean) If set to `true`, the retry will be triggered when the status code is `403`. Default is `true`.
196+
- `status_not_found` (Boolean) If set to `true`, the retry will be triggered when the status code is `404`. Default is `true`.
175197

176198

177199
<a id="nestedblock--timeouts"></a>

docs/resources/resource.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ resource "azapi_resource" "example" {
162162
```
163163

164164
To learn more about JMESPath, visit [JMESPath](https://jmespath.org/).
165-
- `retry` (Attributes) The retry block supports the following arguments: (see [below for nested schema](#nestedatt--retry))
165+
- `retry` (Attributes) The retry object supports the following attributes: (see [below for nested schema](#nestedatt--retry))
166+
- `retry_read_after_create` (Attributes) The retry object supports the following attributes: (see [below for nested schema](#nestedatt--retry_read_after_create))
166167
- `schema_validation_enabled` (Boolean) Whether enabled the validation on `type` and `body` with embedded schema. Defaults to `true`.
167168
- `tags` (Map of String) A mapping of tags which should be assigned to the Azure resource.
168169
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
@@ -208,14 +209,35 @@ Read-Only:
208209

209210
Required:
210211

211-
- `error_message_regex` (List of String) A list of regular expressions to match against error messages. If any of the regular expressions match, the error is considered retryable.
212+
- `error_message_regex` (List of String)
212213

213214
Optional:
214215

215216
- `interval_seconds` (Number) The base number of seconds to wait between retries. Default is `10`.
216217
- `max_interval_seconds` (Number) The maximum number of seconds to wait between retries. Default is `180`.
217218
- `multiplier` (Number) The multiplier to apply to the interval between retries. Default is `1.5`.
218219
- `randomization_factor` (Number) The randomization factor to apply to the interval between retries. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Therefore set to zero `0.0` for no randomization. Default is `0.5`.
220+
- `response_is_nil` (Boolean) If set to `true`, the retry will be triggered when the response is `nil`. Default is `true`.
221+
- `status_forbidden` (Boolean) If set to `true`, the retry will be triggered when the status code is `403`. Default is `true`.
222+
- `status_not_found` (Boolean) If set to `true`, the retry will be triggered when the status code is `404`. Default is `true`.
223+
224+
225+
<a id="nestedatt--retry_read_after_create"></a>
226+
### Nested Schema for `retry_read_after_create`
227+
228+
Required:
229+
230+
- `error_message_regex` (List of String)
231+
232+
Optional:
233+
234+
- `interval_seconds` (Number) The base number of seconds to wait between retries. Default is `10`.
235+
- `max_interval_seconds` (Number) The maximum number of seconds to wait between retries. Default is `180`.
236+
- `multiplier` (Number) The multiplier to apply to the interval between retries. Default is `1.5`.
237+
- `randomization_factor` (Number) The randomization factor to apply to the interval between retries. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Therefore set to zero `0.0` for no randomization. Default is `0.5`.
238+
- `response_is_nil` (Boolean) If set to `true`, the retry will be triggered when the response is `nil`. Default is `true`.
239+
- `status_forbidden` (Boolean) If set to `true`, the retry will be triggered when the status code is `403`. Default is `true`.
240+
- `status_not_found` (Boolean) If set to `true`, the retry will be triggered when the status code is `404`. Default is `true`.
219241

220242

221243
<a id="nestedblock--timeouts"></a>

0 commit comments

Comments
 (0)