Resource schema: TypeList as element for TypeMap


I’m creating a provider where one of resource configurations is a map of string slices map[string][]string. Proposed config will look smth like this:

headers = {
  Content-Type = ["text/html", "charset=utf-8"]

Schema that I wanted to use:

"headers": {
				Type:     schema.TypeMap,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeList,
					Elem: &schema.Schema{Type: schema.TypeString},

But I see that TypeList is not supported as TypeMap element.
Currently I work around this by using TypeString and then splitting it by ; to create config value.

What would be a better way to manage this? Should I stick to my workaround or maybe I should file an issue for sdk and try adding support for map of lists?

The only option I see besides the workaround you posted is to have a resource called “header_key” with a “key” field and a “values” field, with the values field being a list, and then some sort of identifier that identifies the resource this field is split out from.

But I know that’s kind of a hack and not very nice. This is largely a limitation in the Terraform 0.11 and below type system. Terraform 0.12 fixed it, but we haven’t redesigned the SDK to use the new type system yet. In the new type system, your original instinct should be possible, I believe. Unfortunately, that’s just a matter of waiting for the new SDK.