terraform-provider-keycloak icon indicating copy to clipboard operation
terraform-provider-keycloak copied to clipboard

Custom User Federation config list value

Open thyming opened this issue 3 years ago • 2 comments

Hi, I'm having trouble getting keycloak_custom_user_federation to accept a list as a value in the config argument to this provider. I've tried sending all the values as lists, just sending the one value I want as a list, and serializing as json. Did I miss something from the docs? I'm using terraform 0.15.3 and terraform-provider-keycloak 3.1.1. Thank you for this great plugin!!!

thyming avatar Jun 22 '21 15:06 thyming

Unfortunately, map values in HCL are expected to have the same value type, so there is no way to do something like this:

config = {
  foo   = "bar"
  hello = ["world", "again"]
}

However, we could try to treat this similarly to the attributes field for the keycloak_user resource, and define a separator like ## so you can define list values. So it would look something like this:

config = {
  foo   = "bar"
  hello = "world##again"
}

Which you could simplify like this:

config = {
  foo   = "bar"
  hello = join("##", ["world", "again"])
}

Let me know if this approach works for you.

mrparkers avatar Sep 28 '21 15:09 mrparkers

This would be much better than... nothing. :-)

rnemec avatar Aug 02 '22 20:08 rnemec

:+1: for the Idea with the separator. Just hit the same issue. It's the only thing I can't get working with the provider so far. Great Work, Many thanks!

What came to my mind, wouldn't it make sense to encode them as serialized JSON Array? Would be a standard, so easier to generate proper payload, then with a custom separator.

ChrisHubinger avatar Oct 28 '22 07:10 ChrisHubinger