ARTIFACTORY: How to prevent removing existing users from a group when using Terraform API to update the groups

AuthorFullName__c
Andrew Roellig
articleNumber
000006319
FirstPublishedDate
2025-01-06T09:53:48Z
lastModifiedDate
2025-05-21

ARTIFACTORY: How to prevent removing existing users from a group when using Terraform API to update the groups

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.