Error: Custom Provider, ConflictsWith for TypeSet/TypeList

Hi,
I am writing a custom provider and I came across a roadblock pertaining to the behavior of ‘ConflictsWith’ within a schema.TypeSet/TypeList. Please see the snippet of the schema below.

 "acl": {
    Type:     schema.TypeSet,
    Required: true,
    MinItems: 1,
    Elem: &schema.Resource{
        Schema: map[string]*schema.Schema{
            "user_name": {
                Type:          schema.TypeString,
                Optional:      true,
                ConflictsWith: []string{"acl.0.group_name"},
            },
            "group_name": {
                Type:          schema.TypeString,
                Optional:      true,
                ConflictsWith: []string{"acl.0.user_name"},
            },
            "permission": {
                Type:     schema.TypeString,
                Required: true,
            },
        },
    },
    Set: <hashFunc,
}

I want to make sure only one of ‘user_name’ and ‘group_name’ is specified in each acl block. However the following error comes up when I specify ‘user_name’ and ‘group_name’ in separate ‘acl’ blocks.

Error: “acl.1.user_name”: conflicts with acl.0.group_name

How do I make sure the conflict is evaluated within a single element in the set/list instead of across the whole list. Please let me know if I missed something.

1 Like

Yes. I encountered the same issue while specifying like below this in tfconfig. May I know is there any update for this issue?

acl {
    "user_name" = "xxxx"
    "permission" = "xxxxx"
}

acl {
    "group_name" = "xxxx"
    "permission" = "xxxxx"
}

I think you need to do acl.*.group_name. I read somewhere in the code (can’t find it) that * is a sentinel index for a TypeSet.