OpenStack

v3.9.0 published on Thursday, Aug 4, 2022 by Pulumi

Keypair

Import

Keypairs can be imported using the name, e.g.

 $ pulumi import openstack:compute/keypair:Keypair my-keypair test-keypair

Example Usage

Import an Existing Public Key

using Pulumi;
using OpenStack = Pulumi.OpenStack;

class MyStack : Stack
{
    public MyStack()
    {
        var test_keypair = new OpenStack.Compute.Keypair("test-keypair", new OpenStack.Compute.KeypairArgs
        {
            PublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB",
        });
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := compute.NewKeypair(ctx, "test-keypair", &compute.KeypairArgs{
			PublicKey: pulumi.String("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

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

    }
}
import pulumi
import pulumi_openstack as openstack

test_keypair = openstack.compute.Keypair("test-keypair", public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB")
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const test_keypair = new openstack.compute.Keypair("test-keypair", {
    publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB",
});
resources:
  test-keypair:
    type: openstack:compute:Keypair
    properties:
      publicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB

Generate a Public/Private Key Pair

using Pulumi;
using OpenStack = Pulumi.OpenStack;

class MyStack : Stack
{
    public MyStack()
    {
        var test_keypair = new OpenStack.Compute.Keypair("test-keypair", new OpenStack.Compute.KeypairArgs
        {
        });
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := compute.NewKeypair(ctx, "test-keypair", nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Keypair;
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_keypair = new Keypair("test-keypair");

    }
}
import pulumi
import pulumi_openstack as openstack

test_keypair = openstack.compute.Keypair("test-keypair")
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const test_keypair = new openstack.compute.Keypair("test-keypair", {});
resources:
  test-keypair:
    type: openstack:compute:Keypair

Create a Keypair Resource

new Keypair(name: string, args?: KeypairArgs, opts?: CustomResourceOptions);
@overload
def Keypair(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            public_key: Optional[str] = None,
            region: Optional[str] = None,
            user_id: Optional[str] = None,
            value_specs: Optional[Mapping[str, Any]] = None)
@overload
def Keypair(resource_name: str,
            args: Optional[KeypairArgs] = None,
            opts: Optional[ResourceOptions] = None)
func NewKeypair(ctx *Context, name string, args *KeypairArgs, opts ...ResourceOption) (*Keypair, error)
public Keypair(string name, KeypairArgs? args = null, CustomResourceOptions? opts = null)
public Keypair(String name, KeypairArgs args)
public Keypair(String name, KeypairArgs args, CustomResourceOptions options)
type: openstack:compute:Keypair
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args KeypairArgs
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 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 string
The unique name of the resource.
args KeypairArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args KeypairArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args KeypairArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

The Keypair resource accepts the following input properties:

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

UserId string

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

ValueSpecs Dictionary<string, object>

Map of additional options.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

UserId string

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

ValueSpecs map[string]interface{}

Map of additional options.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

userId String

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

valueSpecs Map<String,Object>

Map of additional options.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

userId string

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

valueSpecs {[key: string]: any}

Map of additional options.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

user_id str

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

value_specs Mapping[str, Any]

Map of additional options.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

userId String

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

valueSpecs Map<Any>

Map of additional options.

Outputs

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

Fingerprint string

The fingerprint of the public key.

Id string

The provider-assigned unique ID for this managed resource.

PrivateKey string

The generated private key when no public key is specified.

Fingerprint string

The fingerprint of the public key.

Id string

The provider-assigned unique ID for this managed resource.

PrivateKey string

The generated private key when no public key is specified.

fingerprint String

The fingerprint of the public key.

id String

The provider-assigned unique ID for this managed resource.

privateKey String

The generated private key when no public key is specified.

fingerprint string

The fingerprint of the public key.

id string

The provider-assigned unique ID for this managed resource.

privateKey string

The generated private key when no public key is specified.

fingerprint str

The fingerprint of the public key.

id str

The provider-assigned unique ID for this managed resource.

private_key str

The generated private key when no public key is specified.

fingerprint String

The fingerprint of the public key.

id String

The provider-assigned unique ID for this managed resource.

privateKey String

The generated private key when no public key is specified.

Look up an 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,
        name: Optional[str] = None,
        private_key: Optional[str] = None,
        public_key: Optional[str] = None,
        region: Optional[str] = None,
        user_id: Optional[str] = None,
        value_specs: Optional[Mapping[str, Any]] = 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)
Resource lookup is not supported in YAML
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:
Fingerprint string

The fingerprint of the public key.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

UserId string

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

ValueSpecs Dictionary<string, object>

Map of additional options.

Fingerprint string

The fingerprint of the public key.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

UserId string

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

ValueSpecs map[string]interface{}

Map of additional options.

fingerprint String

The fingerprint of the public key.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

userId String

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

valueSpecs Map<String,Object>

Map of additional options.

fingerprint string

The fingerprint of the public key.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

userId string

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

valueSpecs {[key: string]: any}

Map of additional options.

fingerprint str

The fingerprint of the public key.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

user_id str

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

value_specs Mapping[str, Any]

Map of additional options.

fingerprint String

The fingerprint of the public key.

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

The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the region argument of the provider is used. Changing this creates a new keypair.

userId String

This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.

valueSpecs Map<Any>

Map of additional options.

Package Details

Repository
https://github.com/pulumi/pulumi-openstack
License
Apache-2.0
Notes

This Pulumi package is based on the openstack Terraform Provider.