At least one argument with ConflictsWith

Hello,

I have in one resource of my provider two fields which are in Conflicts.
Only one field should be fulfilled by the user.

It seems that it’s not possible to put these fields as required.
However I need to force the user to put at least one field.

How can I accomplish this ?

Code:

"device_id": {                                                                                
        Type:          schema.TypeInt,                                                              
        Optional:      true,                                                                        
        ConflictsWith: []string{"virtualmachine_id"},                                               
},
"virtualmachine_id": {                                                                        
        Type:          schema.TypeInt,                                                              
        Optional:      true,                                                                        
        ConflictsWith: []string{"device_id"},                                                       
},

Thanks.

I’m not super clear on the requirements here… Do they need to specify at least one field, or exactly one field?

If exactly, I’d recommend ExactlyOneOf.

If at least, but those two can’t be used together, I’d suggest trying AtLeastOneOf in combination with ConflictsWith. I don’t know that anyone’s tried that combination before, but I don’t know offhand a reason why it wouldn’t work.