UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

308 lines (307 loc) 11.2 kB
import * as pulumi from "@pulumi/pulumi"; /** * Manages a keypair resource within HuaweiCloud. * * By default, keypair use the SSH-2 (RSA, 2048) algorithm for encryption and decryption. * * Keys imported support the following cryptographic algorithms: * * * RSA-1024 * * RSA-2048 * * RSA-4096 * * ## Example Usage * ### Create a new KPS keypair * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const kmsKeyId = config.requireObject("kmsKeyId"); * const kmsKeyName = config.requireObject("kmsKeyName"); * const keyFile = config.requireObject("keyFile"); * const test = new huaweicloud.dew.Keypair("test", { * scope: "user", * encryptionType: "kms", * kmsKeyId: kmsKeyId, * kmsKeyName: kmsKeyName, * description: "test description", * keyFile: keyFile, * }); * ``` * ### Import an existing KPS keypair * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const publicKey = config.requireObject("publicKey"); * const privateKey = config.requireObject("privateKey"); * const test = new huaweicloud.dew.Keypair("test", { * scope: "account", * encryptionType: "default", * description: "test description", * publicKey: publicKey, * privateKey: privateKey, * }); * ``` * ### Import an existing KPS keypair without private key * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const publicKey = config.requireObject("publicKey"); * const test = new huaweicloud.dew.Keypair("test", { * scope: "account", * description: "test description", * publicKey: publicKey, * }); * ``` * * ## Import * * Keypair can be imported using the `name`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Dew/keypair:Keypair test <name> * ``` * * Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`encryption_type`, `kms_key_id`, `kms_key_name`, `key_file` and `private_key`. It is generally recommended running `terraform plan` after importing a keypair. You can then decide if changes should be applied to the keypair, or the resource definition should be updated to align with the keypair. Also, you can ignore changes as below. hcl resource "huaweicloud_kps_keypair" "test" { * * ... * * lifecycle { * * ignore_changes = [ * * encryption_type, kms_key_id, kms_key_name, key_file, private_key * * ] * * } } */ export declare class Keypair extends pulumi.CustomResource { /** * Get an existing Keypair resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: KeypairState, opts?: pulumi.CustomResourceOptions): Keypair; /** * Returns true if the given object is an instance of Keypair. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Keypair; /** * The keypair creation time. */ readonly createdAt: pulumi.Output<string>; /** * Specifies the description of keypair. */ readonly description: pulumi.Output<string | undefined>; /** * Specifies encryption mode. The options are as follows: * + **default**: The default encryption mode. Applicable to sites where KMS is not deployed. * + **kms**: KMS encryption mode. */ readonly encryptionType: pulumi.Output<string>; /** * Fingerprint information about a keypair. */ readonly fingerprint: pulumi.Output<string>; /** * Whether the private key is managed by HuaweiCloud. */ readonly isManaged: pulumi.Output<boolean>; /** * Specifies the path of the created private key. * The private key file (**.pem**) is created only when creating a KPS keypair. * Importing an existing keypair will not obtain the private key information. */ readonly keyFile: pulumi.Output<string>; /** * Specifies the KMS key ID to encrypt private keys. */ readonly kmsKeyId: pulumi.Output<string | undefined>; /** * Specifies the KMS key name to encrypt private keys. */ readonly kmsKeyName: pulumi.Output<string | undefined>; /** * Specifies a unique name for the keypair. The name can contain a maximum of `64` * characters, including letters, digits, underscores (_) and hyphens (-). * Changing this parameter will create a new resource. */ readonly name: pulumi.Output<string>; /** * Specifies the imported OpenSSH-formatted private key. */ readonly privateKey: pulumi.Output<string | undefined>; /** * Specifies the imported OpenSSH-formatted public key. * It is required when import keypair. Changing this parameter will create a new resource. */ readonly publicKey: pulumi.Output<string>; /** * Specifies the region in which to create the keypair resource. If omitted, the * provider-level region will be used. Changing this parameter will create a new resource. */ readonly region: pulumi.Output<string>; /** * Specifies the scope of keypair. The options are as follows: * + **account**: Tenant-level, available to all users under the same account. * + **user**: User-level, only available to user. */ readonly scope: pulumi.Output<string>; /** * Specifies the user ID to which the keypair belongs. */ readonly userId: pulumi.Output<string>; /** * Create a Keypair resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: KeypairArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Keypair resources. */ export interface KeypairState { /** * The keypair creation time. */ createdAt?: pulumi.Input<string>; /** * Specifies the description of keypair. */ description?: pulumi.Input<string>; /** * Specifies encryption mode. The options are as follows: * + **default**: The default encryption mode. Applicable to sites where KMS is not deployed. * + **kms**: KMS encryption mode. */ encryptionType?: pulumi.Input<string>; /** * Fingerprint information about a keypair. */ fingerprint?: pulumi.Input<string>; /** * Whether the private key is managed by HuaweiCloud. */ isManaged?: pulumi.Input<boolean>; /** * Specifies the path of the created private key. * The private key file (**.pem**) is created only when creating a KPS keypair. * Importing an existing keypair will not obtain the private key information. */ keyFile?: pulumi.Input<string>; /** * Specifies the KMS key ID to encrypt private keys. */ kmsKeyId?: pulumi.Input<string>; /** * Specifies the KMS key name to encrypt private keys. */ kmsKeyName?: pulumi.Input<string>; /** * Specifies a unique name for the keypair. The name can contain a maximum of `64` * characters, including letters, digits, underscores (_) and hyphens (-). * Changing this parameter will create a new resource. */ name?: pulumi.Input<string>; /** * Specifies the imported OpenSSH-formatted private key. */ privateKey?: pulumi.Input<string>; /** * Specifies the imported OpenSSH-formatted public key. * It is required when import keypair. Changing this parameter will create a new resource. */ publicKey?: pulumi.Input<string>; /** * Specifies the region in which to create the keypair resource. If omitted, the * provider-level region will be used. Changing this parameter will create a new resource. */ region?: pulumi.Input<string>; /** * Specifies the scope of keypair. The options are as follows: * + **account**: Tenant-level, available to all users under the same account. * + **user**: User-level, only available to user. */ scope?: pulumi.Input<string>; /** * Specifies the user ID to which the keypair belongs. */ userId?: pulumi.Input<string>; } /** * The set of arguments for constructing a Keypair resource. */ export interface KeypairArgs { /** * Specifies the description of keypair. */ description?: pulumi.Input<string>; /** * Specifies encryption mode. The options are as follows: * + **default**: The default encryption mode. Applicable to sites where KMS is not deployed. * + **kms**: KMS encryption mode. */ encryptionType?: pulumi.Input<string>; /** * Specifies the path of the created private key. * The private key file (**.pem**) is created only when creating a KPS keypair. * Importing an existing keypair will not obtain the private key information. */ keyFile?: pulumi.Input<string>; /** * Specifies the KMS key ID to encrypt private keys. */ kmsKeyId?: pulumi.Input<string>; /** * Specifies the KMS key name to encrypt private keys. */ kmsKeyName?: pulumi.Input<string>; /** * Specifies a unique name for the keypair. The name can contain a maximum of `64` * characters, including letters, digits, underscores (_) and hyphens (-). * Changing this parameter will create a new resource. */ name?: pulumi.Input<string>; /** * Specifies the imported OpenSSH-formatted private key. */ privateKey?: pulumi.Input<string>; /** * Specifies the imported OpenSSH-formatted public key. * It is required when import keypair. Changing this parameter will create a new resource. */ publicKey?: pulumi.Input<string>; /** * Specifies the region in which to create the keypair resource. If omitted, the * provider-level region will be used. Changing this parameter will create a new resource. */ region?: pulumi.Input<string>; /** * Specifies the scope of keypair. The options are as follows: * + **account**: Tenant-level, available to all users under the same account. * + **user**: User-level, only available to user. */ scope?: pulumi.Input<string>; /** * Specifies the user ID to which the keypair belongs. */ userId?: pulumi.Input<string>; }