1. Packages
  2. Bitbucket Provider
  3. API Docs
  4. SshKey
bitbucket 2.46.0 published on Monday, Apr 14, 2025 by drfaust92

bitbucket.SshKey

Explore with Pulumi AI

Provides a Bitbucket SSH Key resource.

This allows you to manage your SSH Keys for a user.

OAuth2 Scopes: account and account:write

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as bitbucket from "@pulumi/bitbucket";

const test = new bitbucket.SshKey("test", {
    user: data.bitbucket_current_user.test.uuid,
    key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY",
    label: "test-key",
});
Copy
import pulumi
import pulumi_bitbucket as bitbucket

test = bitbucket.SshKey("test",
    user=data["bitbucket_current_user"]["test"]["uuid"],
    key="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY",
    label="test-key")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/bitbucket/v2/bitbucket"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := bitbucket.NewSshKey(ctx, "test", &bitbucket.SshKeyArgs{
			User:  pulumi.Any(data.Bitbucket_current_user.Test.Uuid),
			Key:   pulumi.String("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY"),
			Label: pulumi.String("test-key"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Bitbucket = Pulumi.Bitbucket;

return await Deployment.RunAsync(() => 
{
    var test = new Bitbucket.SshKey("test", new()
    {
        User = data.Bitbucket_current_user.Test.Uuid,
        Key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY",
        Label = "test-key",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.bitbucket.SshKey;
import com.pulumi.bitbucket.SshKeyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var test = new SshKey("test", SshKeyArgs.builder()
            .user(data.bitbucket_current_user().test().uuid())
            .key("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY")
            .label("test-key")
            .build());

    }
}
Copy
resources:
  test:
    type: bitbucket:SshKey
    properties:
      user: ${data.bitbucket_current_user.test.uuid}
      key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY
      label: test-key
Copy

Create SshKey Resource

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

Constructor syntax

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

@overload
def SshKey(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           user: Optional[str] = None,
           key: Optional[str] = None,
           label: Optional[str] = None,
           ssh_key_id: Optional[str] = None)
func NewSshKey(ctx *Context, name string, args SshKeyArgs, opts ...ResourceOption) (*SshKey, error)
public SshKey(string name, SshKeyArgs args, CustomResourceOptions? opts = null)
public SshKey(String name, SshKeyArgs args)
public SshKey(String name, SshKeyArgs args, CustomResourceOptions options)
type: bitbucket:SshKey
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. SshKeyArgs
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. SshKeyArgs
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. SshKeyArgs
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. SshKeyArgs
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. SshKeyArgs
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 sshKeyResource = new Bitbucket.SshKey("sshKeyResource", new()
{
    User = "string",
    Key = "string",
    Label = "string",
    SshKeyId = "string",
});
Copy
example, err := bitbucket.NewSshKey(ctx, "sshKeyResource", &bitbucket.SshKeyArgs{
User: pulumi.String("string"),
Key: pulumi.String("string"),
Label: pulumi.String("string"),
SshKeyId: pulumi.String("string"),
})
Copy
var sshKeyResource = new SshKey("sshKeyResource", SshKeyArgs.builder()
    .user("string")
    .key("string")
    .label("string")
    .sshKeyId("string")
    .build());
Copy
ssh_key_resource = bitbucket.SshKey("sshKeyResource",
    user="string",
    key="string",
    label="string",
    ssh_key_id="string")
Copy
const sshKeyResource = new bitbucket.SshKey("sshKeyResource", {
    user: "string",
    key: "string",
    label: "string",
    sshKeyId: "string",
});
Copy
type: bitbucket:SshKey
properties:
    key: string
    label: string
    sshKeyId: string
    user: string
Copy

SshKey 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 SshKey resource accepts the following input properties:

User This property is required. string
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
Key string
The SSH public key value in OpenSSH format.
Label string
The user-defined label for the SSH key
SshKeyId string
User This property is required. string
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
Key string
The SSH public key value in OpenSSH format.
Label string
The user-defined label for the SSH key
SshKeyId string
user This property is required. String
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
key String
The SSH public key value in OpenSSH format.
label String
The user-defined label for the SSH key
sshKeyId String
user This property is required. string
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
key string
The SSH public key value in OpenSSH format.
label string
The user-defined label for the SSH key
sshKeyId string
user This property is required. str
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
key str
The SSH public key value in OpenSSH format.
label str
The user-defined label for the SSH key
ssh_key_id str
user This property is required. String
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
key String
The SSH public key value in OpenSSH format.
label String
The user-defined label for the SSH key
sshKeyId String

Outputs

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

Comment string
The comment parsed from the SSH key (if present)
Id string
The provider-assigned unique ID for this managed resource.
Uuid string
The SSH key's UUID value.
Comment string
The comment parsed from the SSH key (if present)
Id string
The provider-assigned unique ID for this managed resource.
Uuid string
The SSH key's UUID value.
comment String
The comment parsed from the SSH key (if present)
id String
The provider-assigned unique ID for this managed resource.
uuid String
The SSH key's UUID value.
comment string
The comment parsed from the SSH key (if present)
id string
The provider-assigned unique ID for this managed resource.
uuid string
The SSH key's UUID value.
comment str
The comment parsed from the SSH key (if present)
id str
The provider-assigned unique ID for this managed resource.
uuid str
The SSH key's UUID value.
comment String
The comment parsed from the SSH key (if present)
id String
The provider-assigned unique ID for this managed resource.
uuid String
The SSH key's UUID value.

Look up Existing SshKey Resource

Get an existing SshKey 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?: SshKeyState, opts?: CustomResourceOptions): SshKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        comment: Optional[str] = None,
        key: Optional[str] = None,
        label: Optional[str] = None,
        ssh_key_id: Optional[str] = None,
        user: Optional[str] = None,
        uuid: Optional[str] = None) -> SshKey
func GetSshKey(ctx *Context, name string, id IDInput, state *SshKeyState, opts ...ResourceOption) (*SshKey, error)
public static SshKey Get(string name, Input<string> id, SshKeyState? state, CustomResourceOptions? opts = null)
public static SshKey get(String name, Output<String> id, SshKeyState state, CustomResourceOptions options)
resources:  _:    type: bitbucket:SshKey    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:
Comment string
The comment parsed from the SSH key (if present)
Key string
The SSH public key value in OpenSSH format.
Label string
The user-defined label for the SSH key
SshKeyId string
User string
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
Uuid string
The SSH key's UUID value.
Comment string
The comment parsed from the SSH key (if present)
Key string
The SSH public key value in OpenSSH format.
Label string
The user-defined label for the SSH key
SshKeyId string
User string
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
Uuid string
The SSH key's UUID value.
comment String
The comment parsed from the SSH key (if present)
key String
The SSH public key value in OpenSSH format.
label String
The user-defined label for the SSH key
sshKeyId String
user String
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
uuid String
The SSH key's UUID value.
comment string
The comment parsed from the SSH key (if present)
key string
The SSH public key value in OpenSSH format.
label string
The user-defined label for the SSH key
sshKeyId string
user string
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
uuid string
The SSH key's UUID value.
comment str
The comment parsed from the SSH key (if present)
key str
The SSH public key value in OpenSSH format.
label str
The user-defined label for the SSH key
ssh_key_id str
user str
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
uuid str
The SSH key's UUID value.
comment String
The comment parsed from the SSH key (if present)
key String
The SSH public key value in OpenSSH format.
label String
The user-defined label for the SSH key
sshKeyId String
user String
This can either be the UUID of the account, surrounded by curly-braces, for example: {account UUID}, OR an Atlassian Account ID.
uuid String
The SSH key's UUID value.

Import

SSH Keys can be imported using their user-id/key-id ID, e.g.

$ pulumi import bitbucket:index/sshKey:SshKey key user-id/key-id
Copy

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

Package Details

Repository
bitbucket drfaust92/terraform-provider-bitbucket
License
Notes
This Pulumi package is based on the bitbucket Terraform Provider.