1. Packages
  2. Opentelekomcloud Provider
  3. API Docs
  4. ComputeKeypairV2
opentelekomcloud 1.36.35 published on Monday, Apr 14, 2025 by opentelekomcloud

opentelekomcloud.ComputeKeypairV2

Explore with Pulumi AI

Example Usage

Importing an SSH key

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

const import_keypair = new opentelekomcloud.ComputeKeypairV2("import-keypair", {publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB"});
Copy
import pulumi
import pulumi_opentelekomcloud as opentelekomcloud

import_keypair = opentelekomcloud.ComputeKeypairV2("import-keypair", public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := opentelekomcloud.NewComputeKeypairV2(ctx, "import-keypair", &opentelekomcloud.ComputeKeypairV2Args{
			PublicKey: pulumi.String("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opentelekomcloud = Pulumi.Opentelekomcloud;

return await Deployment.RunAsync(() => 
{
    var import_keypair = new Opentelekomcloud.ComputeKeypairV2("import-keypair", new()
    {
        PublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opentelekomcloud.ComputeKeypairV2;
import com.pulumi.opentelekomcloud.ComputeKeypairV2Args;
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 import_keypair = new ComputeKeypairV2("import-keypair", ComputeKeypairV2Args.builder()
            .publicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB")
            .build());

    }
}
Copy
resources:
  import-keypair:
    type: opentelekomcloud:ComputeKeypairV2
    properties:
      publicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB
Copy

Creating an SSH key

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

const create_keypair = new opentelekomcloud.ComputeKeypairV2("create-keypair", {});
Copy
import pulumi
import pulumi_opentelekomcloud as opentelekomcloud

create_keypair = opentelekomcloud.ComputeKeypairV2("create-keypair")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := opentelekomcloud.NewComputeKeypairV2(ctx, "create-keypair", nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opentelekomcloud = Pulumi.Opentelekomcloud;

return await Deployment.RunAsync(() => 
{
    var create_keypair = new Opentelekomcloud.ComputeKeypairV2("create-keypair");

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opentelekomcloud.ComputeKeypairV2;
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 create_keypair = new ComputeKeypairV2("create-keypair");

    }
}
Copy
resources:
  create-keypair:
    type: opentelekomcloud:ComputeKeypairV2
Copy

Create ComputeKeypairV2 Resource

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

Constructor syntax

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

@overload
def ComputeKeypairV2(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     compute_keypair_v2_id: Optional[str] = None,
                     name: Optional[str] = None,
                     public_key: Optional[str] = None,
                     region: Optional[str] = None,
                     value_specs: Optional[Mapping[str, str]] = None)
func NewComputeKeypairV2(ctx *Context, name string, args *ComputeKeypairV2Args, opts ...ResourceOption) (*ComputeKeypairV2, error)
public ComputeKeypairV2(string name, ComputeKeypairV2Args? args = null, CustomResourceOptions? opts = null)
public ComputeKeypairV2(String name, ComputeKeypairV2Args args)
public ComputeKeypairV2(String name, ComputeKeypairV2Args args, CustomResourceOptions options)
type: opentelekomcloud:ComputeKeypairV2
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 ComputeKeypairV2Args
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 ComputeKeypairV2Args
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 ComputeKeypairV2Args
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 ComputeKeypairV2Args
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. ComputeKeypairV2Args
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 computeKeypairV2Resource = new Opentelekomcloud.ComputeKeypairV2("computeKeypairV2Resource", new()
{
    ComputeKeypairV2Id = "string",
    Name = "string",
    PublicKey = "string",
    Region = "string",
    ValueSpecs = 
    {
        { "string", "string" },
    },
});
Copy
example, err := opentelekomcloud.NewComputeKeypairV2(ctx, "computeKeypairV2Resource", &opentelekomcloud.ComputeKeypairV2Args{
ComputeKeypairV2Id: pulumi.String("string"),
Name: pulumi.String("string"),
PublicKey: pulumi.String("string"),
Region: pulumi.String("string"),
ValueSpecs: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
Copy
var computeKeypairV2Resource = new ComputeKeypairV2("computeKeypairV2Resource", ComputeKeypairV2Args.builder()
    .computeKeypairV2Id("string")
    .name("string")
    .publicKey("string")
    .region("string")
    .valueSpecs(Map.of("string", "string"))
    .build());
Copy
compute_keypair_v2_resource = opentelekomcloud.ComputeKeypairV2("computeKeypairV2Resource",
    compute_keypair_v2_id="string",
    name="string",
    public_key="string",
    region="string",
    value_specs={
        "string": "string",
    })
Copy
const computeKeypairV2Resource = new opentelekomcloud.ComputeKeypairV2("computeKeypairV2Resource", {
    computeKeypairV2Id: "string",
    name: "string",
    publicKey: "string",
    region: "string",
    valueSpecs: {
        string: "string",
    },
});
Copy
type: opentelekomcloud:ComputeKeypairV2
properties:
    computeKeypairV2Id: string
    name: string
    publicKey: string
    region: string
    valueSpecs:
        string: string
Copy

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

ComputeKeypairV2Id string
Name string
A unique name for the keypair. Changing this creates a new keypair.
PublicKey string
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
Region string
ValueSpecs Dictionary<string, string>
Map of additional options.
ComputeKeypairV2Id string
Name string
A unique name for the keypair. Changing this creates a new keypair.
PublicKey string
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
Region string
ValueSpecs map[string]string
Map of additional options.
computeKeypairV2Id String
name String
A unique name for the keypair. Changing this creates a new keypair.
publicKey String
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
region String
valueSpecs Map<String,String>
Map of additional options.
computeKeypairV2Id string
name string
A unique name for the keypair. Changing this creates a new keypair.
publicKey string
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
region string
valueSpecs {[key: string]: string}
Map of additional options.
compute_keypair_v2_id str
name str
A unique name for the keypair. Changing this creates a new keypair.
public_key str
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
region str
value_specs Mapping[str, str]
Map of additional options.
computeKeypairV2Id String
name String
A unique name for the keypair. Changing this creates a new keypair.
publicKey String
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
region String
valueSpecs Map<String>
Map of additional options.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
PrivateKey string
The generated private key when no public key is specified.
Shared bool
Id string
The provider-assigned unique ID for this managed resource.
PrivateKey string
The generated private key when no public key is specified.
Shared bool
id String
The provider-assigned unique ID for this managed resource.
privateKey String
The generated private key when no public key is specified.
shared Boolean
id string
The provider-assigned unique ID for this managed resource.
privateKey string
The generated private key when no public key is specified.
shared boolean
id str
The provider-assigned unique ID for this managed resource.
private_key str
The generated private key when no public key is specified.
shared bool
id String
The provider-assigned unique ID for this managed resource.
privateKey String
The generated private key when no public key is specified.
shared Boolean

Look up Existing ComputeKeypairV2 Resource

Get an existing ComputeKeypairV2 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?: ComputeKeypairV2State, opts?: CustomResourceOptions): ComputeKeypairV2
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        compute_keypair_v2_id: Optional[str] = None,
        name: Optional[str] = None,
        private_key: Optional[str] = None,
        public_key: Optional[str] = None,
        region: Optional[str] = None,
        shared: Optional[bool] = None,
        value_specs: Optional[Mapping[str, str]] = None) -> ComputeKeypairV2
func GetComputeKeypairV2(ctx *Context, name string, id IDInput, state *ComputeKeypairV2State, opts ...ResourceOption) (*ComputeKeypairV2, error)
public static ComputeKeypairV2 Get(string name, Input<string> id, ComputeKeypairV2State? state, CustomResourceOptions? opts = null)
public static ComputeKeypairV2 get(String name, Output<String> id, ComputeKeypairV2State state, CustomResourceOptions options)
resources:  _:    type: opentelekomcloud:ComputeKeypairV2    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:
ComputeKeypairV2Id string
Name string
A unique name for the keypair. Changing this creates a new keypair.
PrivateKey string
The generated private key when no public key is specified.
PublicKey string
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
Region string
Shared bool
ValueSpecs Dictionary<string, string>
Map of additional options.
ComputeKeypairV2Id string
Name string
A unique name for the keypair. Changing this creates a new keypair.
PrivateKey string
The generated private key when no public key is specified.
PublicKey string
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
Region string
Shared bool
ValueSpecs map[string]string
Map of additional options.
computeKeypairV2Id String
name String
A unique name for the keypair. Changing this creates a new keypair.
privateKey String
The generated private key when no public key is specified.
publicKey String
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
region String
shared Boolean
valueSpecs Map<String,String>
Map of additional options.
computeKeypairV2Id string
name string
A unique name for the keypair. Changing this creates a new keypair.
privateKey string
The generated private key when no public key is specified.
publicKey string
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
region string
shared boolean
valueSpecs {[key: string]: string}
Map of additional options.
compute_keypair_v2_id str
name str
A unique name for the keypair. Changing this creates a new keypair.
private_key str
The generated private key when no public key is specified.
public_key str
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
region str
shared bool
value_specs Mapping[str, str]
Map of additional options.
computeKeypairV2Id String
name String
A unique name for the keypair. Changing this creates a new keypair.
privateKey String
The generated private key when no public key is specified.
publicKey String
A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
region String
shared Boolean
valueSpecs Map<String>
Map of additional options.

Import

Key pairs can be imported using the name, e.g.

$ pulumi import opentelekomcloud:index/computeKeypairV2:ComputeKeypairV2 my-keypair test-keypair
Copy

Imported key pairs are considered to be not shared.

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

Package Details

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