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.