Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
NiklasRosenstein opened this issue May 3, 2024 · 2 comments · Fixed by #73
Closed

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

NiklasRosenstein opened this issue May 3, 2024 · 2 comments · Fixed by #73
Assignees
Labels
bug Something isn't working

Comments

@NiklasRosenstein
Copy link

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 NiklasRosenstein added the bug Something isn't working label May 3, 2024
@NiklasRosenstein
Copy link
Author

NiklasRosenstein commented May 3, 2024

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"]
          }
        ]
        : []
      )
    }
  }
}

@NiklasRosenstein NiklasRosenstein changed the title Not settings artifact.actions.groups results in a permanent diff Setting artifact.actions.groups = [] results in a perpetual diff May 3, 2024
@alexhung
Copy link
Member

alexhung commented May 3, 2024

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

alexhung added a commit that referenced this issue May 7, 2024
…oups-list

Fix state drift with empty set for permission resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants