jfrog / terraform-provider-platform

Terraform provider to manage JFrog Platform
https://jfrog.com
Apache License 2.0
1 stars 1 forks source link

Setting `artifact.actions.groups = []` results in a perpetual diff #70

Closed NiklasRosenstein closed 2 months ago

NiklasRosenstein commented 2 months ago

Describe the bug

It appears that when you don't set artifact = { actions = { groups = [] } } } (and instead simply don't specify the attribute), it results in a permanent diff on every run.

image

Provider version 1.7.2

NiklasRosenstein commented 2 months ago

Actually, sorry, I misread our own code.

Setting it to an empty list seems to be causing the perpetual diff.

This particular resource is defined as this, hence it does set groups to an empty list in certain cases and does not omit the attribute as originally described.

resource "platform_permission" "publish" {
  for_each = local.grouped_repositories
  name     = "project-${var.project_id}-${each.key}"

  artifact = {
    targets = [
      for repo in keys(each.value.repositories) :
      {
        name             = repo
        include_patterns = local.artifactory_include_patterns_by_group_name[each.value.group_name].include_patterns
      }
    ]

    actions = {
      users = [
        {
          name        = var.artifactory_publish_users[each.value.release_type]
          permissions = [for permission in var.artifactory_permissions[each.value.release_type] : upper(permission)]
        }
      ]

      groups = (
        each.value.release_type == "playground"
        ? [
          for group in var.artifactory_developer_groups :
          {
            name        = group
            permissions = ["READ", "WRITE", "ANNOTATE", "DELETE", "MANAGE"]
          }
        ]
        : []
      )
    }
  }
}
alexhung commented 2 months ago

@NiklasRosenstein Thanks! I've added to our plan to investigate.