1. Packages
  2. Gcorelabs Provider
  3. API Docs
  4. Keypair
gcorelabs 0.3.63 published on Monday, Apr 14, 2025 by g-core

gcorelabs.Keypair

Explore with Pulumi AI

Represent a ssh key, do not depends on region

Example Usage

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

const kpgcore_keypair = new gcore.index.Gcore_keypair("kpgcore_keypair", {
    projectId: 1,
    publicKey: "your public key here",
    sshkeyName: "test",
});
export const kp = kpgcore_keypair;
Copy
import pulumi
import pulumi_gcore as gcore

kpgcore_keypair = gcore.index.Gcore_keypair("kpgcore_keypair",
    project_id=1,
    public_key=your public key here,
    sshkey_name=test)
pulumi.export("kp", kpgcore_keypair)
Copy
package main

import (
	"github.com/pulumi/pulumi-gcore/sdk/go/gcore"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		kpgcore_keypair, err := gcore.NewGcore_keypair(ctx, "kpgcore_keypair", &gcore.Gcore_keypairArgs{
			ProjectId:  1,
			PublicKey:  "your public key here",
			SshkeyName: "test",
		})
		if err != nil {
			return err
		}
		ctx.Export("kp", kpgcore_keypair)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcore = Pulumi.Gcore;

return await Deployment.RunAsync(() => 
{
    var kpgcore_keypair = new Gcore.Index.Gcore_keypair("kpgcore_keypair", new()
    {
        ProjectId = 1,
        PublicKey = "your public key here",
        SshkeyName = "test",
    });

    return new Dictionary<string, object?>
    {
        ["kp"] = kpgcore_keypair,
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcore.gcore_keypair;
import com.pulumi.gcore.Gcore_keypairArgs;
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 kpgcore_keypair = new Gcore_keypair("kpgcore_keypair", Gcore_keypairArgs.builder()
            .projectId(1)
            .publicKey("your public key here")
            .sshkeyName("test")
            .build());

        ctx.export("kp", kpgcore_keypair);
    }
}
Copy
resources:
  kpgcore_keypair:
    type: gcore:gcore_keypair
    properties:
      projectId: 1
      publicKey: your public key here
      sshkeyName: test
outputs:
  kp: ${kpgcore_keypair}
Copy

Create Keypair Resource

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

Constructor syntax

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

@overload
def Keypair(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            public_key: Optional[str] = None,
            sshkey_name: Optional[str] = None,
            keypair_id: Optional[str] = None,
            project_id: Optional[float] = None,
            project_name: Optional[str] = None)
func NewKeypair(ctx *Context, name string, args KeypairArgs, opts ...ResourceOption) (*Keypair, error)
public Keypair(string name, KeypairArgs args, CustomResourceOptions? opts = null)
public Keypair(String name, KeypairArgs args)
public Keypair(String name, KeypairArgs args, CustomResourceOptions options)
type: gcorelabs:Keypair
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. KeypairArgs
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. KeypairArgs
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. KeypairArgs
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. KeypairArgs
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. KeypairArgs
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 keypairResource = new Gcorelabs.Keypair("keypairResource", new()
{
    PublicKey = "string",
    SshkeyName = "string",
    KeypairId = "string",
    ProjectId = 0,
    ProjectName = "string",
});
Copy
example, err := gcorelabs.NewKeypair(ctx, "keypairResource", &gcorelabs.KeypairArgs{
PublicKey: pulumi.String("string"),
SshkeyName: pulumi.String("string"),
KeypairId: pulumi.String("string"),
ProjectId: pulumi.Float64(0),
ProjectName: pulumi.String("string"),
})
Copy
var keypairResource = new Keypair("keypairResource", KeypairArgs.builder()
    .publicKey("string")
    .sshkeyName("string")
    .keypairId("string")
    .projectId(0)
    .projectName("string")
    .build());
Copy
keypair_resource = gcorelabs.Keypair("keypairResource",
    public_key="string",
    sshkey_name="string",
    keypair_id="string",
    project_id=0,
    project_name="string")
Copy
const keypairResource = new gcorelabs.Keypair("keypairResource", {
    publicKey: "string",
    sshkeyName: "string",
    keypairId: "string",
    projectId: 0,
    projectName: "string",
});
Copy
type: gcorelabs:Keypair
properties:
    keypairId: string
    projectId: 0
    projectName: string
    publicKey: string
    sshkeyName: string
Copy

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

PublicKey This property is required. string
SshkeyName This property is required. string
KeypairId string
The ID of this resource.
ProjectId double
ProjectName string
PublicKey This property is required. string
SshkeyName This property is required. string
KeypairId string
The ID of this resource.
ProjectId float64
ProjectName string
publicKey This property is required. String
sshkeyName This property is required. String
keypairId String
The ID of this resource.
projectId Double
projectName String
publicKey This property is required. string
sshkeyName This property is required. string
keypairId string
The ID of this resource.
projectId number
projectName string
public_key This property is required. str
sshkey_name This property is required. str
keypair_id str
The ID of this resource.
project_id float
project_name str
publicKey This property is required. String
sshkeyName This property is required. String
keypairId String
The ID of this resource.
projectId Number
projectName String

Outputs

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

Fingerprint string
Id string
The provider-assigned unique ID for this managed resource.
SshkeyId string
Fingerprint string
Id string
The provider-assigned unique ID for this managed resource.
SshkeyId string
fingerprint String
id String
The provider-assigned unique ID for this managed resource.
sshkeyId String
fingerprint string
id string
The provider-assigned unique ID for this managed resource.
sshkeyId string
fingerprint str
id str
The provider-assigned unique ID for this managed resource.
sshkey_id str
fingerprint String
id String
The provider-assigned unique ID for this managed resource.
sshkeyId String

Look up Existing Keypair Resource

Get an existing Keypair 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?: KeypairState, opts?: CustomResourceOptions): Keypair
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        fingerprint: Optional[str] = None,
        keypair_id: Optional[str] = None,
        project_id: Optional[float] = None,
        project_name: Optional[str] = None,
        public_key: Optional[str] = None,
        sshkey_id: Optional[str] = None,
        sshkey_name: Optional[str] = None) -> Keypair
func GetKeypair(ctx *Context, name string, id IDInput, state *KeypairState, opts ...ResourceOption) (*Keypair, error)
public static Keypair Get(string name, Input<string> id, KeypairState? state, CustomResourceOptions? opts = null)
public static Keypair get(String name, Output<String> id, KeypairState state, CustomResourceOptions options)
resources:  _:    type: gcorelabs:Keypair    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:
Fingerprint string
KeypairId string
The ID of this resource.
ProjectId double
ProjectName string
PublicKey string
SshkeyId string
SshkeyName string
Fingerprint string
KeypairId string
The ID of this resource.
ProjectId float64
ProjectName string
PublicKey string
SshkeyId string
SshkeyName string
fingerprint String
keypairId String
The ID of this resource.
projectId Double
projectName String
publicKey String
sshkeyId String
sshkeyName String
fingerprint string
keypairId string
The ID of this resource.
projectId number
projectName string
publicKey string
sshkeyId string
sshkeyName string
fingerprint str
keypair_id str
The ID of this resource.
project_id float
project_name str
public_key str
sshkey_id str
sshkey_name str
fingerprint String
keypairId String
The ID of this resource.
projectId Number
projectName String
publicKey String
sshkeyId String
sshkeyName String

Package Details

Repository
gcorelabs g-core/terraform-provider-gcorelabs
License
Notes
This Pulumi package is based on the gcorelabs Terraform Provider.