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

Not able to manage users in project with project admin role permissions using terraform. #74

Closed
Prakashreddy134 opened this issue May 8, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@Prakashreddy134
Copy link

Prakashreddy134 commented May 8, 2023

Hi Team,

I am trying to manage users in artifactory project and i have project admin role permissions but not able to apply changes using terraform.

Here is the script :

resource "project" "mypro" {
    block_deployments_on_limit = false      
    description                = "My Project"
    display_name               = "dev-test"
    email_notification         = true        
    key                        = "dev001"
    max_storage_in_gibibytes   = 1
    lifecycle {
      ignore_changes = [
          repos
      ]
    }
    admin_privileges {
        index_resources  = true
        manage_members   = true
        manage_resources = true
    }
    member {
        name  = "prakash"
        roles = [
            "Project Admin",
        ]
    }
    member {
        name  = "user1"
        roles = [
            "Viewer",
        ]
    }
    member {
        name  = "user2"
        roles = [
            "Viewer",
        ]
    }
}

Here is the error i am getting while performing terraform apply

"project.mypro: Creating...

│ Error:
│ 403 POST https://prakashrd.jfrog.io/access/api/v1/projects
│ {
│   "errors" : [ {
│     "code" : "FORBIDDEN",
│     "message" : "Logged in 'prakash' is not an admin."
│   } ]
│ }

│   with project.mypro,
│   on main.tf line 39, in resource "project" "mypro":
│   39: resource "project" "mypro" {

"

Please help me is there any solution to skip this error and I can't get admin role for entire org if required.

Thanks in advance.

@Prakashreddy134 Prakashreddy134 added the enhancement New feature or request label May 8, 2023
@danielmkn danielmkn self-assigned this May 8, 2023
@alexhung
Copy link
Member

alexhung commented May 8, 2023

@Prakashreddy134 From the error message, it looks like this is the first time you are creating this project on Artifactory? In order to create a project, it requires a user assigned with the 'Administer the Platform' role. See https://jfrog.com/help/r/jfrog-rest-apis/add-a-new-project

@Prakashreddy134
Copy link
Author

@alexhung No, I am doing this task for existing project and i imported project terraform import and performing updates. I don't have Administer the Platform role and I have a project admin role only, is there any solution with out 'Administer the Platform' role.

@chb0github
Copy link
Contributor

Can you manually do this through the UI @Prakashreddy134 ? Using the provider doesn't grant anything special. If you can't do it through the UI, then you need to talk to your platform admin.

If you can do it through the UI, then it may be an actual bug with artifactory which would be outside the scope of this team (happy to direct you though). Please report back

@Prakashreddy134
Copy link
Author

Prakashreddy134 commented May 9, 2023

@chb0github I am able to do manually through the UI but my requirement is to perform this through terraform with project admin role. is this possible?

@alexhung
Copy link
Member

alexhung commented May 9, 2023

@Prakashreddy134 Does the token for the provider you are using have admin_privileges.manage_resoures permission (see https://jfrog.com/help/r/jfrog-rest-apis/update-user-in-project)?

@chb0github
Copy link
Contributor

You know, I didn't think of that, but the token you have could be restricted. That would explain it. I second @alexhung

@alexhung
Copy link
Member

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants