How do I represent a heterogenous list in a TF provider schema?

Hi @john_tipper :wave:

I’ve provided a potential schema which could accommodate your requirements in the thread on Does a TF provider support state shared between resources within a provider?.

Something along the following lines should work:

func (e *exampleResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
	resp.Schema = schema.Schema{
		Attributes: map[string]schema.Attribute{
			"listeners": schema.ListNestedAttribute{
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"type": schema.StringAttribute{},
						"entry_points": schema.ListAttribute{
							ElementType: types.StringType, // assuming all strings ,
						},
						"servers": schema.ListAttribute{
							ElementType: types.StringType, // assuming all strings ,
						},
						"paths": schema.ListAttribute{
							ElementType: types.StringType, // assuming all strings ,
						},
						"path_mappings": schema.ListAttribute{
							ElementType: types.StringType, // assuming all strings ,
						},
						"cors": schema.SingleNestedAttribute{
							Attributes: map[string]schema.Attribute{
								"allow_credentials": schema.BoolAttribute{}, // assuming this is a bool,
								"allow_headers":     schema.BoolAttribute{}, // assuming this is a bool,
							},
						},
					},
				},
			},
		},
	}
}