Mongey / terraform-provider-kafka

Terraform provider for managing Apache Kafka Topics + ACLs
MIT License
518 stars 129 forks source link

fix: wait for quota state after creation #385

Closed sbuliarca closed 7 months ago

sbuliarca commented 7 months ago

We are using this provider to maintain kafka resources, including quotas.
When creating and updating quotas is fails in 90% of cases because the provider creates it in kafka, and then immediately queries for it, but it doesn't find it at this point, as it seems it takes a little bit of time to appear in Kafka.

Here are the logs we were getting for such a scenario:

[INFO] Alter quota: timestamp="2024-02-19T12:46:14.578+0200"
[TRACE] Alter Quota Request &{0 [{[{user 0 User:CN=dev-enablement/test-tf-apply}] [{request_percentage 100 false} {consumer_byte_rate 5.24288e+06 false} {producer_byte_rate 5.24288e+06 false}]}] false}: timestamp="2024-02-19T12:46:14.578+0200"
[TRACE] ThrottleTime: 0: timestamp="2024-02-19T12:46:15.178+0200"
[INFO] Reading Quota: timestamp="2024-02-19T12:46:15.179+0200"
[INFO] Reading Quota User:CN=dev-enablement/test-tf-apply: timestamp="2024-02-19T12:46:15.179+0200"
[INFO] Describing Quota: timestamp="2024-02-19T12:46:15.179+0200"
[TRACE] Describe Quota Request &{0 [{user 0 User:CN=dev-enablement/test-tf-apply}] true}: timestamp="2024-02-19T12:46:15.179+0200"
[TRACE] ThrottleTime: 0: timestamp="2024-02-19T12:46:15.242+0200"
[ERROR] Error getting quota User:CN=dev-enablement/test-tf-apply could not be found from Kafka: timestamp="2024-02-19T12:46:15.242+0200"

With this fix, we'll be waiting until the quota is created in Kafka (just like for topics). I tested this locally and it fixes the issue.

Mongey commented 7 months ago

Thanks! looks good

sbuliarca commented 7 months ago

Thanks! looks good

@Mongey Thank you for taking care of it so quickly!

When can we expect a new release containing this fix?