While using terraform with a usermap.yml to create and update groups and users in Artifactory you may run into an issue where the terraform api will wipe all existing users in a group while adding a new user to it. This is because our terraform api will tell Artifactory that the group needs to change its members list to include just the new user.
Solution
In order to prevent existing users from being removed from the group, will need to add the ignore changes property in your permissions.tf file like below:
resource "platform_group" "admin-group" {
name = "MYGROUP"
description = "System Admin access group"
auto_join = false
admin_privileges = true
lifecycle {
ignore_changes = [
members, # This will prevent Terraform from trying to update the members list
]
}
}
After adding this property you can then add new users to the usermap.yml and it will not wipe the existing members.