aiven / terraform-provider-aiven

Aiven Terraform Provider
https://registry.terraform.io/providers/aiven/aiven/latest/docs
MIT License
129 stars 70 forks source link

Add more verbose output about kafka schema compatibility #200

Open hklasa opened 4 years ago

hklasa commented 4 years ago

Hello.

Currently we are facing with the issue in CI/CD that terrafrorm produce following log:

Error: kafka schema is not compatible with version :4

  on .terraform/modules/kafka_data/modules/service_kafka_data/main.tf line 36, in resource "aiven_kafka_schema" "this":
  36: resource "aiven_kafka_schema" "this" {

Error: kafka schema is not compatible with version :4

  on .terraform/modules/kafka_data/modules/service_kafka_data/main.tf line 36, in resource "aiven_kafka_schema" "this":
  36: resource "aiven_kafka_schema" "this" {

We cannot fastly determine which schema is not compatible with Aiven schema registry. Can you add more verbose output to this error log with an information about schema subject?

ivan-savciuc commented 4 years ago

Hello,

It looks like there is no error in your case coming from the Aiven API which may help to understand a compatibility issue - more can be found here https://github.com/aiven/aiven-go-client/blob/master/kafka_schemas.go#L227

If we do have an error message coming from Aiven API response on an attempt to add a new Kafka Schema TF users should see that, but there is none in your case.

I will have a look if we have another API endpoint or any way to provide more information regarding schema compatibility issues.

ivan-savciuc commented 4 years ago

After testing Aiven API Kafka Schema validation endpoint, it looks it sends back an error with explanation only in the situation when a user tries to send a broken Avro format and responds with 500 HTTP. But when a user tries to send an incompatible schema, it returns only a boolean compatibility flag, and in case it is false TF users see that generic error message Kafka schema is not compatible with version: %n.

I created a ticket to improve this situation in our internal issue tracker, unfortunately, cannot give you a link. No changes in TF provider itself are necessary, and when this feature will out, all users will immediately benefit from it.

hklasa commented 4 years ago

Thank you, Ivan. I am looking forward for news regarding this enhancement.