logzio / terraform-provider-logzio

Terraform provider for logz.io alerts, endpoints and users
Apache License 2.0
19 stars 17 forks source link

Handle 429 errors from Logz.io API #105

Closed smelchior closed 2 years ago

smelchior commented 2 years ago

We have a terraform state that defines multiple subaccounts:

resource "logzio_subaccount" "test1" {
...
}
resource "logzio_subaccount" "test2" {
...
}
resource "logzio_subaccount" "test3" {
...
}

(in total 9 accounts). When applying this state we get 2-3 429 errors:

│ Error: API call GetSubAccount failed with status code 429, data: Too Many Requests
│
│   with logzio_subaccount.test1,
│   on main.tf line 6, in resource "logzio_subaccount" "test1":
│    6: resource "logzio_subaccount" "test1" {
│
╵
╷
│ Error: API call GetSubAccount failed with status code 429, data: Too Many Requests
│
│   with logzio_subaccount.test2,
│   on main.tf line 21, in resource "logzio_subaccount" "test2":
│   21: resource "logzio_subaccount" "test2" {
│
╵
╷
│ Error: API call GetSubAccount failed with status code 429, data: Too Many Requests
│
│   with logzio_subaccount.test3,
│   on main.tf line 120, in resource "logzio_subaccount" "test3":
│  120: resource "logzio_subaccount" "test3" {
│

This should be handled inside the module with some kind of exponential backoff. We currently cannot apply this state properly.

mirii1994 commented 2 years ago

Thanks for letting us know. We will add a backoff in our next version.

mirii1994 commented 2 years ago

@smelchior v1.8.2 is out and should handle this. Can you please confirm that your issue was resolved? :)

smelchior commented 2 years ago

@mirii1994 works perfectly, thanks for the quick fix!