confluentinc / terraform-provider-confluentcloud

Confluent Cloud Terraform Provider is deprecated in favor of Confluent Terraform Provider
https://registry.terraform.io/providers/confluentinc/confluentcloud/latest/docs
52 stars 23 forks source link

[UX] - Adding details to errors #28

Closed jshcmpbll closed 2 years ago

jshcmpbll commented 2 years ago

I know right now there is the 403 for having the wrong API (lack of access to the EA program for terraform) but I also had and issue with the following error:

Error: 402 Payment Required

I wasn't given the proper context to the issue until I ran my apply with debug finding the following:

2021-12-15T14:21:51.690-0800 [INFO]  Starting apply for module.confluentcloud_kafka_dev.confluentcloud_environment.default
2021-12-15T14:21:51.690-0800 [DEBUG] module.confluentcloud_kafka_dev.confluentcloud_environment.default: applying the planned Create change
2021-12-15T14:21:52.018-0800 [INFO]  provider.terraform-provider-confluentcloud_0.2.0: 2021/12/15 14:21:52 [ERROR] Environment create failed &{<nil> <nil> <nil> <nil> 0xc000174b30}, &{402 Payment Required 402 HTTP/1.1 1 1 map[Access-Control-Allow-Credentials:[true] Access-Control-Allow-Headers:[Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range] Access-Control-Allow-Methods:[GET,POST,OPTIONS,PUT,DELETE,PATCH] Connection:[keep-alive] Content-Length:[232] Content-Type:[application/json] Date:[Wed, 15 Dec 2021 22:21:51 GMT] Server:[nginx] Strict-Transport-Security:[max-age=31536000; includeSubDomains; preload] X-Content-Type-Options:[nosniff] X-Frame-Options:[deny] X-Request-Id:[******************************] X-Xss-Protection:[1; mode=block]] {{
  "errors": [
    {
      "id": "**********************",
      "status": "402",
      "code": "quota_exceeded",
      "detail": "Your organization is currently limited to 50 environments",
      "source": {}
    }
  ]
}} 232 [] false false map[] *************************}, 402 Payment Required: timestamp=2021-12-15T14:21:52.018-0800

If possible, I think it would be helpful to provide users with that detail line when there is an error and possibly even adding details around that 403 for users that skip the docs and try to use the provider with the wrong API..

Hope this helps with the development of the provider 😄 Feel free to close it if it's not.

linouk23 commented 2 years ago

Thanks for creating this issue @jshcmpbll!

I definitely agree that our lack of error messages is very confusing and that's something we've been working on so hopefully we'll fix it in our next 0.3.0 release, stay tuned!

linouk23 commented 2 years ago

👋 @jshcmpbll please check out our most recent 0.4.0 release where we fixed the issue!