1. Packages
  2. Harbor
  3. API Docs
  4. RobotAccount
Harbor v3.10.19 published on Monday, Feb 10, 2025 by Pulumiverse

harbor.RobotAccount

Explore with Pulumi AI

Example Usage

System Level

Introduced in harbor 2.2.0, system level robot accounts can have basically all available permissions in harbor and are not dependent on a single project.

Global

resource "random_password" "password" {
  length  = 12
  special = false
}

resource "harbor_project" "main" {
    name = "main"
}

resource "harbor_robot_account" "system" {
  name        = "example-system"
  description = "system level robot account"
  level       = "system"
  secret      = resource.random_password.password.result
  permissions {
    access {
      action   = "create"
      resource = "label"
    }
    kind      = "system"
    namespace = "/"
  }
  permissions {
    access {
      action   = "push"
      resource = "repository"
    }
    kind      = "project"
    namespace = harbor_project.main.name
  }
  permissions {
    access {
      action   = "pull"
      resource = "repository"
    }
    kind      = "project"
    namespace = "*"
  }
}
Copy

The above example, creates a system level robot account with permissions to

  • permission to create labels on system level
  • pull repository across all projects
  • push repository to project “my-project-name”

Project

Other than system level robot accounts, project level robot accounts can interact on project level only. The available permissions are mostly the same as for system level robots.

resource "harbor_project" "main" {
    name = "main"
}

resource "harbor_robot_account" "project" {
  name        = "example-project"
  description = "project level robot account"
  level       = "project"
  permissions {
    access {
      action   = "pull"
      resource = "repository"
    }
    access {
      action   = "push"
      resource = "repository"
    }
    kind      = "project"
    namespace = harbor_project.main.name
  }
}
Copy

The above example creates a project level robot account with permissions to

  • pull repository on project “main”
  • push repository on project “main”

Create RobotAccount Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RobotAccount(name: string, args: RobotAccountArgs, opts?: CustomResourceOptions);
@overload
def RobotAccount(resource_name: str,
                 args: RobotAccountArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def RobotAccount(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 level: Optional[str] = None,
                 permissions: Optional[Sequence[RobotAccountPermissionArgs]] = None,
                 description: Optional[str] = None,
                 disable: Optional[bool] = None,
                 duration: Optional[int] = None,
                 name: Optional[str] = None,
                 secret: Optional[str] = None)
func NewRobotAccount(ctx *Context, name string, args RobotAccountArgs, opts ...ResourceOption) (*RobotAccount, error)
public RobotAccount(string name, RobotAccountArgs args, CustomResourceOptions? opts = null)
public RobotAccount(String name, RobotAccountArgs args)
public RobotAccount(String name, RobotAccountArgs args, CustomResourceOptions options)
type: harbor:RobotAccount
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RobotAccountArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RobotAccountArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RobotAccountArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RobotAccountArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RobotAccountArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var robotAccountResource = new Harbor.RobotAccount("robotAccountResource", new()
{
    Level = "string",
    Permissions = new[]
    {
        new Harbor.Inputs.RobotAccountPermissionArgs
        {
            Accesses = new[]
            {
                new Harbor.Inputs.RobotAccountPermissionAccessArgs
                {
                    Action = "string",
                    Resource = "string",
                    Effect = "string",
                },
            },
            Kind = "string",
            Namespace = "string",
        },
    },
    Description = "string",
    Disable = false,
    Duration = 0,
    Name = "string",
    Secret = "string",
});
Copy
example, err := harbor.NewRobotAccount(ctx, "robotAccountResource", &harbor.RobotAccountArgs{
	Level: pulumi.String("string"),
	Permissions: harbor.RobotAccountPermissionArray{
		&harbor.RobotAccountPermissionArgs{
			Accesses: harbor.RobotAccountPermissionAccessArray{
				&harbor.RobotAccountPermissionAccessArgs{
					Action:   pulumi.String("string"),
					Resource: pulumi.String("string"),
					Effect:   pulumi.String("string"),
				},
			},
			Kind:      pulumi.String("string"),
			Namespace: pulumi.String("string"),
		},
	},
	Description: pulumi.String("string"),
	Disable:     pulumi.Bool(false),
	Duration:    pulumi.Int(0),
	Name:        pulumi.String("string"),
	Secret:      pulumi.String("string"),
})
Copy
var robotAccountResource = new RobotAccount("robotAccountResource", RobotAccountArgs.builder()
    .level("string")
    .permissions(RobotAccountPermissionArgs.builder()
        .accesses(RobotAccountPermissionAccessArgs.builder()
            .action("string")
            .resource("string")
            .effect("string")
            .build())
        .kind("string")
        .namespace("string")
        .build())
    .description("string")
    .disable(false)
    .duration(0)
    .name("string")
    .secret("string")
    .build());
Copy
robot_account_resource = harbor.RobotAccount("robotAccountResource",
    level="string",
    permissions=[{
        "accesses": [{
            "action": "string",
            "resource": "string",
            "effect": "string",
        }],
        "kind": "string",
        "namespace": "string",
    }],
    description="string",
    disable=False,
    duration=0,
    name="string",
    secret="string")
Copy
const robotAccountResource = new harbor.RobotAccount("robotAccountResource", {
    level: "string",
    permissions: [{
        accesses: [{
            action: "string",
            resource: "string",
            effect: "string",
        }],
        kind: "string",
        namespace: "string",
    }],
    description: "string",
    disable: false,
    duration: 0,
    name: "string",
    secret: "string",
});
Copy
type: harbor:RobotAccount
properties:
    description: string
    disable: false
    duration: 0
    level: string
    name: string
    permissions:
        - accesses:
            - action: string
              effect: string
              resource: string
          kind: string
          namespace: string
    secret: string
Copy

RobotAccount Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RobotAccount resource accepts the following input properties:

Level
This property is required.
Changes to this property will trigger replacement.
string
Level of the robot account, currently either system or project.
Permissions This property is required. List<Pulumiverse.Harbor.Inputs.RobotAccountPermission>
Description string
The description of the robot account will be displayed in harbor.
Disable bool
Disables the robot account when set to true.
Duration int
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
Name Changes to this property will trigger replacement. string
The name of the project that will be created in harbor.
Secret string
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
Level
This property is required.
Changes to this property will trigger replacement.
string
Level of the robot account, currently either system or project.
Permissions This property is required. []RobotAccountPermissionArgs
Description string
The description of the robot account will be displayed in harbor.
Disable bool
Disables the robot account when set to true.
Duration int
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
Name Changes to this property will trigger replacement. string
The name of the project that will be created in harbor.
Secret string
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
level
This property is required.
Changes to this property will trigger replacement.
String
Level of the robot account, currently either system or project.
permissions This property is required. List<RobotAccountPermission>
description String
The description of the robot account will be displayed in harbor.
disable Boolean
Disables the robot account when set to true.
duration Integer
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
name Changes to this property will trigger replacement. String
The name of the project that will be created in harbor.
secret String
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
level
This property is required.
Changes to this property will trigger replacement.
string
Level of the robot account, currently either system or project.
permissions This property is required. RobotAccountPermission[]
description string
The description of the robot account will be displayed in harbor.
disable boolean
Disables the robot account when set to true.
duration number
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
name Changes to this property will trigger replacement. string
The name of the project that will be created in harbor.
secret string
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
level
This property is required.
Changes to this property will trigger replacement.
str
Level of the robot account, currently either system or project.
permissions This property is required. Sequence[RobotAccountPermissionArgs]
description str
The description of the robot account will be displayed in harbor.
disable bool
Disables the robot account when set to true.
duration int
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
name Changes to this property will trigger replacement. str
The name of the project that will be created in harbor.
secret str
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
level
This property is required.
Changes to this property will trigger replacement.
String
Level of the robot account, currently either system or project.
permissions This property is required. List<Property Map>
description String
The description of the robot account will be displayed in harbor.
disable Boolean
Disables the robot account when set to true.
duration Number
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
name Changes to this property will trigger replacement. String
The name of the project that will be created in harbor.
secret String
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.

Outputs

All input properties are implicitly available as output properties. Additionally, the RobotAccount resource produces the following output properties:

FullName string
Id string
The provider-assigned unique ID for this managed resource.
RobotId string
FullName string
Id string
The provider-assigned unique ID for this managed resource.
RobotId string
fullName String
id String
The provider-assigned unique ID for this managed resource.
robotId String
fullName string
id string
The provider-assigned unique ID for this managed resource.
robotId string
full_name str
id str
The provider-assigned unique ID for this managed resource.
robot_id str
fullName String
id String
The provider-assigned unique ID for this managed resource.
robotId String

Look up Existing RobotAccount Resource

Get an existing RobotAccount resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RobotAccountState, opts?: CustomResourceOptions): RobotAccount
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        disable: Optional[bool] = None,
        duration: Optional[int] = None,
        full_name: Optional[str] = None,
        level: Optional[str] = None,
        name: Optional[str] = None,
        permissions: Optional[Sequence[RobotAccountPermissionArgs]] = None,
        robot_id: Optional[str] = None,
        secret: Optional[str] = None) -> RobotAccount
func GetRobotAccount(ctx *Context, name string, id IDInput, state *RobotAccountState, opts ...ResourceOption) (*RobotAccount, error)
public static RobotAccount Get(string name, Input<string> id, RobotAccountState? state, CustomResourceOptions? opts = null)
public static RobotAccount get(String name, Output<String> id, RobotAccountState state, CustomResourceOptions options)
resources:  _:    type: harbor:RobotAccount    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Description string
The description of the robot account will be displayed in harbor.
Disable bool
Disables the robot account when set to true.
Duration int
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
FullName string
Level Changes to this property will trigger replacement. string
Level of the robot account, currently either system or project.
Name Changes to this property will trigger replacement. string
The name of the project that will be created in harbor.
Permissions List<Pulumiverse.Harbor.Inputs.RobotAccountPermission>
RobotId string
Secret string
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
Description string
The description of the robot account will be displayed in harbor.
Disable bool
Disables the robot account when set to true.
Duration int
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
FullName string
Level Changes to this property will trigger replacement. string
Level of the robot account, currently either system or project.
Name Changes to this property will trigger replacement. string
The name of the project that will be created in harbor.
Permissions []RobotAccountPermissionArgs
RobotId string
Secret string
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
description String
The description of the robot account will be displayed in harbor.
disable Boolean
Disables the robot account when set to true.
duration Integer
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
fullName String
level Changes to this property will trigger replacement. String
Level of the robot account, currently either system or project.
name Changes to this property will trigger replacement. String
The name of the project that will be created in harbor.
permissions List<RobotAccountPermission>
robotId String
secret String
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
description string
The description of the robot account will be displayed in harbor.
disable boolean
Disables the robot account when set to true.
duration number
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
fullName string
level Changes to this property will trigger replacement. string
Level of the robot account, currently either system or project.
name Changes to this property will trigger replacement. string
The name of the project that will be created in harbor.
permissions RobotAccountPermission[]
robotId string
secret string
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
description str
The description of the robot account will be displayed in harbor.
disable bool
Disables the robot account when set to true.
duration int
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
full_name str
level Changes to this property will trigger replacement. str
Level of the robot account, currently either system or project.
name Changes to this property will trigger replacement. str
The name of the project that will be created in harbor.
permissions Sequence[RobotAccountPermissionArgs]
robot_id str
secret str
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.
description String
The description of the robot account will be displayed in harbor.
disable Boolean
Disables the robot account when set to true.
duration Number
By default, the robot account will not expire. Set it to the amount of days until the account should expire.
fullName String
level Changes to this property will trigger replacement. String
Level of the robot account, currently either system or project.
name Changes to this property will trigger replacement. String
The name of the project that will be created in harbor.
permissions List<Property Map>
robotId String
secret String
The secret of the robot account used for authentication. Defaults to random generated string from Harbor.

Supporting Types

RobotAccountPermission
, RobotAccountPermissionArgs

Accesses This property is required. List<Pulumiverse.Harbor.Inputs.RobotAccountPermissionAccess>
Kind This property is required. string
Either system or project.
Namespace This property is required. string
namespace is the name of your project. For kind system permissions, always use / as namespace. Use * to match all projects.
Accesses This property is required. []RobotAccountPermissionAccess
Kind This property is required. string
Either system or project.
Namespace This property is required. string
namespace is the name of your project. For kind system permissions, always use / as namespace. Use * to match all projects.
accesses This property is required. List<RobotAccountPermissionAccess>
kind This property is required. String
Either system or project.
namespace This property is required. String
namespace is the name of your project. For kind system permissions, always use / as namespace. Use * to match all projects.
accesses This property is required. RobotAccountPermissionAccess[]
kind This property is required. string
Either system or project.
namespace This property is required. string
namespace is the name of your project. For kind system permissions, always use / as namespace. Use * to match all projects.
accesses This property is required. Sequence[RobotAccountPermissionAccess]
kind This property is required. str
Either system or project.
namespace This property is required. str
namespace is the name of your project. For kind system permissions, always use / as namespace. Use * to match all projects.
accesses This property is required. List<Property Map>
kind This property is required. String
Either system or project.
namespace This property is required. String
namespace is the name of your project. For kind system permissions, always use / as namespace. Use * to match all projects.

RobotAccountPermissionAccess
, RobotAccountPermissionAccessArgs

Action This property is required. string
Eg. push, pull, read, etc. Check available actions.
Resource This property is required. string
Eg. repository, labels, etc. Check available resources.
Effect string
Either allow or deny. Defaults to allow.
Action This property is required. string
Eg. push, pull, read, etc. Check available actions.
Resource This property is required. string
Eg. repository, labels, etc. Check available resources.
Effect string
Either allow or deny. Defaults to allow.
action This property is required. String
Eg. push, pull, read, etc. Check available actions.
resource This property is required. String
Eg. repository, labels, etc. Check available resources.
effect String
Either allow or deny. Defaults to allow.
action This property is required. string
Eg. push, pull, read, etc. Check available actions.
resource This property is required. string
Eg. repository, labels, etc. Check available resources.
effect string
Either allow or deny. Defaults to allow.
action This property is required. str
Eg. push, pull, read, etc. Check available actions.
resource This property is required. str
Eg. repository, labels, etc. Check available resources.
effect str
Either allow or deny. Defaults to allow.
action This property is required. String
Eg. push, pull, read, etc. Check available actions.
resource This property is required. String
Eg. repository, labels, etc. Check available resources.
effect String
Either allow or deny. Defaults to allow.

Import

$ pulumi import harbor:index/robotAccount:RobotAccount system /robots/123
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
harbor pulumiverse/pulumi-harbor
License
Apache-2.0
Notes
This Pulumi package is based on the harbor Terraform Provider.