goharbor/terraform-provider-harbor

Add user-group permission to robot user

Closed this issue · 2 comments

Describe the bug
I want to add user-group permissions to one of my robot account.

But when I use the resource shown below I get the following error:

harbor_robot_account.terraform: Creating...
╷
│ Error: [ERROR] unexpected status code got: 400 expected: 201
│  {"errors":[{"code":"BAD_REQUEST","message":"bad request permission: user-group:delete"}]}
│
│
│   with harbor_robot_account.terraform,
│   on serviceaccount.tf line 6, in resource "harbor_robot_account" "terraform":
│    6: resource "harbor_robot_account" "terraform" {

But there is an delete action for the user-group resource as you can see here.

To Reproduce

  • create a harbor_robot_account resource as described below:
resource "harbor_robot_account" "terraform" {
  name        = "terraform"
  description = "system level robot account"
  level       = "system"
  secret      = "test"
  permissions {
    access {
      action   = "create"
      resource = "project"
    }
    access {
      action   = "list"
      resource = "project"
    }
    access {
      action   = "create"
      resource = "user-group"
    }
    access {
      action   = "delete"
      resource = "user-group"
    }
    access {
      action   = "read"
      resource = "user-group"
    }
    access {
      action   = "update"
      resource = "user-group"
    }
    kind      = "system"
    namespace = "/"
  }
  permissions {
    access {
      action   = "delete"
      resource = "project"
    }
    access {
      action   = "read"
      resource = "project"
    }
    access {
      action   = "update"
      resource = "project"
    }
    kind      = "project"
    namespace = "*"
  }
}

Expected behavior
A robot user that gets grants for user-group

Additional context

  • Provider Version: v3.10.9
  • Terraform Version: v1.8.0
  • Harbor Version: v2.10.1-b7b88476

with the 2.10 version harbor API support less robot rights
can you add your use case here : goharbor/harbor#20076 ?

I will update the doc of the provider

can you add your use case here : goharbor/harbor#20076 ?

done