Hi
I work on one of the Terraform AWS provider resources (aws_workspaces_directory) and need to calculate added and removed elements for the string slice attribute. Does provider already have some func for this or should I add my own? What is the regular location for this helper funcs in the codebase?
"ip_group_ids": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
},
...
if d.HasChange("ip_group_ids") {
o, n := d.GetChange("ip_group_ids")
// Need to calculate diff
// added := ...
// removed := ...
_, err := conn.AssociateIpGroups(&workspaces.AssociateIpGroupsInput{
DirectoryId: aws.String(d.Id()),
GroupIds: added,
})
...
_, err := conn. DisassociateIpGroups(&workspaces. DisassociateIpGroupsInput{
DirectoryId: aws.String(d.Id()),
GroupIds: removed,
})
}