jfrog / terraform-provider-platform

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

Incorrect repository permission target selection for platform_permission resource from the platform provider #48

Closed hsiddiqui84 closed 6 months ago

hsiddiqui84 commented 6 months ago

Describe the bug

Artifactory Cloud version: 7.78.1 Terraform version: 1.3.6 Artifactory provider version: 10.3.1 Platform provider version: 1.5.0

I replaced the deprecated resource artifactory_permission_target from the artifactory provider with the new resource platform_permission from the platform provider and the repo association looks incorrect on the UI.

Original HCL snippet with artifactory_permission_target:

resource "artifactory_permission_target" "support" {
  name = "support"

  repo {
    repositories = ["ANY REMOTE"]

    actions {
      groups {
        name        = "support"
        permissions = ["delete"]
      }
    }
  }
}

New HCL snippet with platform_permission:

resource "platform_permission" "support" {
  name = "support"

  artifact = {
    actions = {
      groups = [
        {
          name = "support"
          permissions = ["DELETE"]
        }
      ]
    }

    targets = [
      {
        name = "ANY_REMOTE"
      }
    ]
  }
}

Using ANY_REMOTE does not select the correct repo as can be seen in this screenshot:

Screenshot 2024-04-03 at 16 24 05

Requirements for and issue

Expected behavior The repository should appear as Any Remote instead of ANY_REMOTE as part of the respective permission.

hsiddiqui84 commented 6 months ago

This is what it looks like with artifactory_permission_target:

Screenshot 2024-04-03 at 16 34 52
alexhung commented 6 months ago

@hsiddiqui84 Thanks for the report! Looks like a bug in parsing the ANY_ repository type in the provider. I'll add this to our plan.

hsiddiqui84 commented 6 months ago

It seems when the repo appears selected correctly, the groups tab shows that repo resource type is not selected correctly:

Screenshot 2024-04-03 at 17 17 43

However, it appears to be selected correctly with ANY_REMOTE as part of platform_permission:

Screenshot 2024-04-03 at 17 19 42
hsiddiqui84 commented 6 months ago

@alexhung it seems using ANY_REMOTE is the right thing to do but it does not show up correctly on the repo permission target UI.

alexhung commented 6 months ago

@hsiddiqui84 The correct value to use is without the underscore actually. The documentation is incorrect. Try ANY REMOTE.