aminueza / terraform-provider-minio

Terraform provider for managing MinIO S3 buckets and IAM Users.
https://registry.terraform.io/providers/aminueza/minio
GNU Affero General Public License v3.0
238 stars 69 forks source link

Errors messages do not include full message from server. #99

Open lathspell opened 3 years ago

lathspell commented 3 years ago

I tried creating a used and just got:

Error: Failed to parse server response: invalid character 'P' looking for beginning of value.

This is not very helpful, it would be better if the complete response or at least the first e.g. 80 chars would be printed. Maybe I used the wrong URL or my authentication was wrong (doesn't matter here, the issue is not abount my config mistake just about the error messsage.

I'm using aminueza/minio-1.2.0 with terraform 0.14.7


2021/03/10 14:57:39 [TRACE] GRPCProvider: PlanResourceChange
2021/03/10 14:57:39 [WARN] Provider "registry.terraform.io/aminueza/minio" produced an invalid plan for minio_iam_user.minio_user, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .update_secret: planned value cty.False does not match config value cty.NullVal(cty.Bool)
      - .disable_user: planned value cty.False does not match config value cty.NullVal(cty.Bool)
      - .force_destroy: planned value cty.False does not match config value cty.NullVal(cty.Bool)
2021/03/10 14:57:39 [TRACE] EvalCheckPlannedChange: Verifying that actual change (action Create) matches planned change (action Create)
2021/03/10 14:57:39 [TRACE] EvalReadState: reading state for minio_iam_user.minio_user
2021/03/10 14:57:39 [TRACE] EvalReadState: no state present for minio_iam_user.minio_user
minio_iam_user.minio_user: Creating...
2021/03/10 14:57:39 [DEBUG] EvalApply: ProviderMeta config value set
2021/03/10 14:57:39 [DEBUG] minio_iam_user.minio_user: applying the planned Create change
2021/03/10 14:57:39 [TRACE] GRPCProvider: ApplyResourceChange

2021/03/10 14:57:44 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "minio_iam_user.minio_user"
2021/03/10 14:57:44 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/aminueza/minio\"] (close)" is waiting for "minio_iam_user.minio_user"
2021/03/10 14:57:44 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)"
2021/03/10 14:57:44 [DEBUG] minio_iam_user.minio_user: apply errored, but we're indicating that via the Error pointer rather than returning it: Failed to parse server response: invalid character 'P' looking for beginning of value.
2021/03/10 14:57:44 [TRACE] EvalMaybeTainted: minio_iam_user.minio_user encountered an error during creation, so it is now marked as tainted
toabi commented 3 years ago

Indeed it would make debugging much easier. My example:

module.minio.minio_iam_user.my_user: Creating...

Error: Failed to parse server response: invalid character '<' looking for beginning of value.

  on modules/minio/configuration.tf line 6, in resource "minio_iam_user" "my_user":
   6: resource "minio_iam_user" "my_user" {
ntdt commented 3 years ago

It'll helpful to debug, I have no problem using this provider to create an user on a minio docker, but with minio deployed on k8s and a ingress-nginx, I have this error message Error: Failed to parse server response: invalid character '<' looking for beginning of value. so my focus is on ingress-nginx.

selfuryon commented 3 years ago

I have similar problem with kubernetes #112

selfuryon commented 3 years ago

Test it without nginx-ingress, and it works fine, so problem really is in ingress controller

ntdt commented 3 years ago

Agreed, I'll close this issue.

selfuryon commented 3 years ago

In my case the problem was in TLS provider configuration. This provider sets minio_ssl to false by default, so it was the reason of weird message outputs and not working apply. Needs to set minio_ssl to true for tls/ssl

provider "minio" {
  ...
  minio_ssl    = true
}
ntdt commented 3 years ago

In my case the problem was in TLS provider configuration. This provider sets minio_ssl to false by default, so it was the reason of weird message outputs and not working apply. Needs to set minio_ssl to true for tls/ssl

provider "minio" {
  ...
  minio_ssl    = true
}

It works with this option minio_ssl = true

enmanuelmoreira commented 10 months ago

It works for me with this option minio_ssl = true

(Minio on k3s cluster behind nginx ingress)