1. Packages
  2. Gcore Provider
  3. API Docs
  4. CloudSshKey
Viewing docs for gcore 2.0.0-alpha.2
published on Tuesday, Mar 24, 2026 by g-core
gcore logo
Viewing docs for gcore 2.0.0-alpha.2
published on Tuesday, Mar 24, 2026 by g-core

    SSH key pairs provide secure authentication to cloud instances, supporting both generated and imported public keys.

    Example Usage

    Upload an existing SSH key

    Add an SSH public key that can be used when creating instances.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    // Upload an existing SSH public key
    const deployer = new gcore.CloudSshKey("deployer", {
        projectId: 1,
        name: "deployer-key",
        publicKey: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJe8rDJP... deployer@workstation",
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    # Upload an existing SSH public key
    deployer = gcore.CloudSshKey("deployer",
        project_id=1,
        name="deployer-key",
        public_key="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJe8rDJP... deployer@workstation")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/v2/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Upload an existing SSH public key
    		_, err := gcore.NewCloudSshKey(ctx, "deployer", &gcore.CloudSshKeyArgs{
    			ProjectId: pulumi.Float64(1),
    			Name:      pulumi.String("deployer-key"),
    			PublicKey: pulumi.String("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJe8rDJP... deployer@workstation"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        // Upload an existing SSH public key
        var deployer = new Gcore.CloudSshKey("deployer", new()
        {
            ProjectId = 1,
            Name = "deployer-key",
            PublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJe8rDJP... deployer@workstation",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.CloudSshKey;
    import com.pulumi.gcore.CloudSshKeyArgs;
    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) {
            // Upload an existing SSH public key
            var deployer = new CloudSshKey("deployer", CloudSshKeyArgs.builder()
                .projectId(1.0)
                .name("deployer-key")
                .publicKey("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJe8rDJP... deployer@workstation")
                .build());
    
        }
    }
    
    resources:
      # Upload an existing SSH public key
      deployer:
        type: gcore:CloudSshKey
        properties:
          projectId: 1
          name: deployer-key
          publicKey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJe8rDJP... deployer@workstation
    

    Tip: Generate a key pair locally with ssh-keygen -t ed25519, then paste the contents of the .pub file into public_key.

    Create CloudSshKey Resource

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

    Constructor syntax

    new CloudSshKey(name: string, args: CloudSshKeyArgs, opts?: CustomResourceOptions);
    @overload
    def CloudSshKey(resource_name: str,
                    args: CloudSshKeyArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def CloudSshKey(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    public_key: Optional[str] = None,
                    name: Optional[str] = None,
                    project_id: Optional[float] = None,
                    shared_in_project: Optional[bool] = None)
    func NewCloudSshKey(ctx *Context, name string, args CloudSshKeyArgs, opts ...ResourceOption) (*CloudSshKey, error)
    public CloudSshKey(string name, CloudSshKeyArgs args, CustomResourceOptions? opts = null)
    public CloudSshKey(String name, CloudSshKeyArgs args)
    public CloudSshKey(String name, CloudSshKeyArgs args, CustomResourceOptions options)
    
    type: gcore:CloudSshKey
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args CloudSshKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args CloudSshKeyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args CloudSshKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CloudSshKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CloudSshKeyArgs
    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 cloudSshKeyResource = new Gcore.CloudSshKey("cloudSshKeyResource", new()
    {
        PublicKey = "string",
        Name = "string",
        ProjectId = 0,
        SharedInProject = false,
    });
    
    example, err := gcore.NewCloudSshKey(ctx, "cloudSshKeyResource", &gcore.CloudSshKeyArgs{
    	PublicKey:       pulumi.String("string"),
    	Name:            pulumi.String("string"),
    	ProjectId:       pulumi.Float64(0),
    	SharedInProject: pulumi.Bool(false),
    })
    
    var cloudSshKeyResource = new CloudSshKey("cloudSshKeyResource", CloudSshKeyArgs.builder()
        .publicKey("string")
        .name("string")
        .projectId(0.0)
        .sharedInProject(false)
        .build());
    
    cloud_ssh_key_resource = gcore.CloudSshKey("cloudSshKeyResource",
        public_key="string",
        name="string",
        project_id=0,
        shared_in_project=False)
    
    const cloudSshKeyResource = new gcore.CloudSshKey("cloudSshKeyResource", {
        publicKey: "string",
        name: "string",
        projectId: 0,
        sharedInProject: false,
    });
    
    type: gcore:CloudSshKey
    properties:
        name: string
        projectId: 0
        publicKey: string
        sharedInProject: false
    

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

    PublicKey string
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    Name string
    SSH key name
    ProjectId double
    Project ID
    SharedInProject bool
    SSH key is shared with all users in the project
    PublicKey string
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    Name string
    SSH key name
    ProjectId float64
    Project ID
    SharedInProject bool
    SSH key is shared with all users in the project
    publicKey String
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    name String
    SSH key name
    projectId Double
    Project ID
    sharedInProject Boolean
    SSH key is shared with all users in the project
    publicKey string
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    name string
    SSH key name
    projectId number
    Project ID
    sharedInProject boolean
    SSH key is shared with all users in the project
    public_key str
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    name str
    SSH key name
    project_id float
    Project ID
    shared_in_project bool
    SSH key is shared with all users in the project
    publicKey String
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    name String
    SSH key name
    projectId Number
    Project ID
    sharedInProject Boolean
    SSH key is shared with all users in the project

    Outputs

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

    CreatedAt string
    SSH key creation time
    Fingerprint string
    Fingerprint
    Id string
    The provider-assigned unique ID for this managed resource.
    State string
    SSH key state Available values: "ACTIVE", "DELETING".
    CreatedAt string
    SSH key creation time
    Fingerprint string
    Fingerprint
    Id string
    The provider-assigned unique ID for this managed resource.
    State string
    SSH key state Available values: "ACTIVE", "DELETING".
    createdAt String
    SSH key creation time
    fingerprint String
    Fingerprint
    id String
    The provider-assigned unique ID for this managed resource.
    state String
    SSH key state Available values: "ACTIVE", "DELETING".
    createdAt string
    SSH key creation time
    fingerprint string
    Fingerprint
    id string
    The provider-assigned unique ID for this managed resource.
    state string
    SSH key state Available values: "ACTIVE", "DELETING".
    created_at str
    SSH key creation time
    fingerprint str
    Fingerprint
    id str
    The provider-assigned unique ID for this managed resource.
    state str
    SSH key state Available values: "ACTIVE", "DELETING".
    createdAt String
    SSH key creation time
    fingerprint String
    Fingerprint
    id String
    The provider-assigned unique ID for this managed resource.
    state String
    SSH key state Available values: "ACTIVE", "DELETING".

    Look up Existing CloudSshKey Resource

    Get an existing CloudSshKey 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?: CloudSshKeyState, opts?: CustomResourceOptions): CloudSshKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            fingerprint: Optional[str] = None,
            name: Optional[str] = None,
            project_id: Optional[float] = None,
            public_key: Optional[str] = None,
            shared_in_project: Optional[bool] = None,
            state: Optional[str] = None) -> CloudSshKey
    func GetCloudSshKey(ctx *Context, name string, id IDInput, state *CloudSshKeyState, opts ...ResourceOption) (*CloudSshKey, error)
    public static CloudSshKey Get(string name, Input<string> id, CloudSshKeyState? state, CustomResourceOptions? opts = null)
    public static CloudSshKey get(String name, Output<String> id, CloudSshKeyState state, CustomResourceOptions options)
    resources:  _:    type: gcore:CloudSshKey    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    CreatedAt string
    SSH key creation time
    Fingerprint string
    Fingerprint
    Name string
    SSH key name
    ProjectId double
    Project ID
    PublicKey string
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    SharedInProject bool
    SSH key is shared with all users in the project
    State string
    SSH key state Available values: "ACTIVE", "DELETING".
    CreatedAt string
    SSH key creation time
    Fingerprint string
    Fingerprint
    Name string
    SSH key name
    ProjectId float64
    Project ID
    PublicKey string
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    SharedInProject bool
    SSH key is shared with all users in the project
    State string
    SSH key state Available values: "ACTIVE", "DELETING".
    createdAt String
    SSH key creation time
    fingerprint String
    Fingerprint
    name String
    SSH key name
    projectId Double
    Project ID
    publicKey String
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    sharedInProject Boolean
    SSH key is shared with all users in the project
    state String
    SSH key state Available values: "ACTIVE", "DELETING".
    createdAt string
    SSH key creation time
    fingerprint string
    Fingerprint
    name string
    SSH key name
    projectId number
    Project ID
    publicKey string
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    sharedInProject boolean
    SSH key is shared with all users in the project
    state string
    SSH key state Available values: "ACTIVE", "DELETING".
    created_at str
    SSH key creation time
    fingerprint str
    Fingerprint
    name str
    SSH key name
    project_id float
    Project ID
    public_key str
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    shared_in_project bool
    SSH key is shared with all users in the project
    state str
    SSH key state Available values: "ACTIVE", "DELETING".
    createdAt String
    SSH key creation time
    fingerprint String
    Fingerprint
    name String
    SSH key name
    projectId Number
    Project ID
    publicKey String
    The public part of an SSH key is the shareable portion of an SSH key pair. It can be safely sent to servers or services to grant access. It does not contain sensitive information. You must provide your own public key (usually found in a file like id_ed25519.pub or id_rsa.pub). Generate your SSH keypair locally using ssh-keygen before providing it here.
    sharedInProject Boolean
    SSH key is shared with all users in the project
    state String
    SSH key state Available values: "ACTIVE", "DELETING".

    Import

    $ pulumi import gcore:index/cloudSshKey:CloudSshKey example '<project_id>/<ssh_key_id>'
    

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

    Package Details

    Repository
    gcore g-core/terraform-provider-gcore
    License
    Notes
    This Pulumi package is based on the gcore Terraform Provider.
    gcore logo
    Viewing docs for gcore 2.0.0-alpha.2
    published on Tuesday, Mar 24, 2026 by g-core
      Try Pulumi Cloud free. Your team will thank you.