openstack.compute.Keypair
Explore with Pulumi AI
Example Usage
Import an Existing Public Key
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const test_keypair = new openstack.compute.Keypair("test-keypair", {
name: "my-keypair",
publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB",
});
import pulumi
import pulumi_openstack as openstack
test_keypair = openstack.compute.Keypair("test-keypair",
name="my-keypair",
public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB")
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/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{
Name: pulumi.String("my-keypair"),
PublicKey: pulumi.String("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var test_keypair = new OpenStack.Compute.Keypair("test-keypair", new()
{
Name = "my-keypair",
PublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB",
});
});
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()
.name("my-keypair")
.publicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB")
.build());
}
}
resources:
test-keypair:
type: openstack:compute:Keypair
properties:
name: my-keypair
publicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB
Generate a Public/Private Key Pair
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const test_keypair = new openstack.compute.Keypair("test-keypair", {name: "my-keypair"});
import pulumi
import pulumi_openstack as openstack
test_keypair = openstack.compute.Keypair("test-keypair", name="my-keypair")
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/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{
Name: pulumi.String("my-keypair"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var test_keypair = new OpenStack.Compute.Keypair("test-keypair", new()
{
Name = "my-keypair",
});
});
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()
.name("my-keypair")
.build());
}
}
resources:
test-keypair:
type: openstack:compute:Keypair
properties:
name: my-keypair
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: Optional[KeypairArgs] = None,
opts: Optional[ResourceOptions] = None)
@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, str]] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var keypairResource = new OpenStack.Compute.Keypair("keypairResource", new()
{
Name = "string",
PublicKey = "string",
Region = "string",
UserId = "string",
ValueSpecs =
{
{ "string", "string" },
},
});
example, err := compute.NewKeypair(ctx, "keypairResource", &compute.KeypairArgs{
Name: pulumi.String("string"),
PublicKey: pulumi.String("string"),
Region: pulumi.String("string"),
UserId: pulumi.String("string"),
ValueSpecs: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var keypairResource = new Keypair("keypairResource", KeypairArgs.builder()
.name("string")
.publicKey("string")
.region("string")
.userId("string")
.valueSpecs(Map.of("string", "string"))
.build());
keypair_resource = openstack.compute.Keypair("keypairResource",
name="string",
public_key="string",
region="string",
user_id="string",
value_specs={
"string": "string",
})
const keypairResource = new openstack.compute.Keypair("keypairResource", {
name: "string",
publicKey: "string",
region: "string",
userId: "string",
valueSpecs: {
string: "string",
},
});
type: openstack:compute:Keypair
properties:
name: string
publicKey: string
region: string
userId: string
valueSpecs:
string: string
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:
- Name string
- A unique name for the keypair. Changing this creates a new keypair.
- Public
Key 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. - User
Id 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.
- Value
Specs Dictionary<string, string> - Map of additional options.
- Name string
- A unique name for the keypair. Changing this creates a new keypair.
- Public
Key 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. - User
Id 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.
- Value
Specs map[string]string - Map of additional options.
- name String
- A unique name for the keypair. Changing this creates a new keypair.
- public
Key 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. - user
Id 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.
- value
Specs Map<String,String> - Map of additional options.
- name string
- A unique name for the keypair. Changing this creates a new keypair.
- public
Key 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. - user
Id 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.
- value
Specs {[key: string]: string} - 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, str] - Map of additional options.
- name String
- A unique name for the keypair. Changing this creates a new keypair.
- public
Key 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. - user
Id 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.
- value
Specs Map<String> - 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.
- Private
Key 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.
- Private
Key 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.
- private
Key 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.
- private
Key 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.
- private
Key String - The generated private key when no public key is specified.
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,
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, 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)
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.
- Fingerprint string
- The fingerprint of the public key.
- Name string
- A unique name for the keypair. Changing this creates a new keypair.
- Private
Key string - The generated private key when no public key is specified.
- Public
Key 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. - User
Id 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.
- Value
Specs Dictionary<string, string> - 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.
- Private
Key string - The generated private key when no public key is specified.
- Public
Key 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. - User
Id 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.
- Value
Specs map[string]string - 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.
- private
Key String - The generated private key when no public key is specified.
- public
Key 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. - user
Id 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.
- value
Specs Map<String,String> - 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.
- private
Key string - The generated private key when no public key is specified.
- public
Key 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. - user
Id 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.
- value
Specs {[key: string]: string} - 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, str] - 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.
- private
Key String - The generated private key when no public key is specified.
- public
Key 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. - user
Id 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.
- value
Specs Map<String> - Map of additional options.
Import
Keypairs can be imported using the name
, e.g.
$ pulumi import openstack:compute/keypair:Keypair my-keypair test-keypair
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- OpenStack pulumi/pulumi-openstack
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
openstack
Terraform Provider.