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

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

Closed
3 tasks done
hsiddiqui84 opened this issue Apr 3, 2024 · 5 comments · Fixed by #49
Assignees
Labels
bug Something isn't working

Comments

@hsiddiqui84
Copy link

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

  • A fully functioning terraform snippet that can be copy&pasted (no outside files or ENV vars unless that's part of the issue)
  • Your version of artifactory (you can curl it at $host/artifactory/api/system/version
  • Your version of terraform

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

@hsiddiqui84 hsiddiqui84 added the bug Something isn't working label Apr 3, 2024
@hsiddiqui84
Copy link
Author

This is what it looks like with artifactory_permission_target:
Screenshot 2024-04-03 at 16 34 52

@alexhung
Copy link
Member

alexhung commented Apr 3, 2024

@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.

@alexhung alexhung transferred this issue from jfrog/terraform-provider-project Apr 3, 2024
@hsiddiqui84
Copy link
Author

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
Copy link
Author

@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
Copy link
Member

alexhung commented Apr 3, 2024

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

alexhung added a commit that referenced this issue Apr 3, 2024
Update documentation to match API's 'ANY' repo types
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