kevholditch / terraform-provider-kong

kong provider for terraform
MIT License
179 stars 91 forks source link

`kong_consumer` resources require both `username` and `custom_id` to be set to non-empty strings #137

Closed andrew-bulford-form3 closed 3 years ago

andrew-bulford-form3 commented 3 years ago

The docs state that both the username and custom_id properties are "semi-optional" - at least one of them must be set. However, if you try to set only one of these options an error is returned, complaining that the property length must be at least 1.

I have a fix for this locally but it's dependent on a a local fix to https://github.com/Kong/go-kong/issues/94.

Terraform Version

v0.13.7

Affected Resource(s)

Terraform Configuration Files

resource "kong_consumer" "consumer" {
  username = "my-username"
}

Expected Behavior

A consumer can be created with either the username or custom_id set, they don't both need to be, as per the docs.

Actual Behavior

Attempting to create a consumer with no custom_id set causes an error to be returned, complaining that the custom_id property must be at least 1 character long:

Error: failed to create kong consumer: &{<nil> 0xc00033d6f0 0xc00033d5f0 <nil> []} error: HTTP status 400 (message: "schema violation (custom_id: length must be at least 1)")

Steps to Reproduce

  1. Create kong_consumer resource with username defined and custom_id omitted
  2. terraform apply

References

The following issue needs resolving to support update properly in the provider: