com.pulumi.aws.lightsail.KeyPair Maven / Gradle / Ivy
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.aws.lightsail;
import com.pulumi.aws.Utilities;
import com.pulumi.aws.lightsail.KeyPairArgs;
import com.pulumi.aws.lightsail.inputs.KeyPairState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a Lightsail Key Pair, for use with Lightsail Instances. These key pairs
* are separate from EC2 Key Pairs, and must be created or imported for use with
* Lightsail.
*
* > **Note:** Lightsail is currently only supported in a limited number of AWS Regions, please see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details
*
* ## Example Usage
*
* ### Create New Key Pair
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.lightsail.KeyPair;
* import com.pulumi.aws.lightsail.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) {
* // Create a new Lightsail Key Pair
* var lgKeyPair = new KeyPair("lgKeyPair", KeyPairArgs.builder()
* .name("lg_key_pair")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ### Create New Key Pair with PGP Encrypted Private Key
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.lightsail.KeyPair;
* import com.pulumi.aws.lightsail.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 lgKeyPair = new KeyPair("lgKeyPair", KeyPairArgs.builder()
* .name("lg_key_pair")
* .pgpKey("keybase:keybaseusername")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ### Existing Public Key Import
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.lightsail.KeyPair;
* import com.pulumi.aws.lightsail.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 lgKeyPair = new KeyPair("lgKeyPair", KeyPairArgs.builder()
* .name("importing")
* .publicKey(StdFunctions.file(FileArgs.builder()
* .input("~/.ssh/id_rsa.pub")
* .build()).result())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* You cannot import Lightsail Key Pairs because the private and public key are only available on initial creation.
*
*/
@ResourceType(type="aws:lightsail/keyPair:KeyPair")
public class KeyPair extends com.pulumi.resources.CustomResource {
/**
* The ARN of the Lightsail key pair.
*
*/
@Export(name="arn", refs={String.class}, tree="[0]")
private Output arn;
/**
* @return The ARN of the Lightsail key pair.
*
*/
public Output arn() {
return this.arn;
}
/**
* The MD5 public key fingerprint for the encrypted private key.
*
*/
@Export(name="encryptedFingerprint", refs={String.class}, tree="[0]")
private Output encryptedFingerprint;
/**
* @return The MD5 public key fingerprint for the encrypted private key.
*
*/
public Output encryptedFingerprint() {
return this.encryptedFingerprint;
}
/**
* the private key material, base 64 encoded and encrypted with the given `pgp_key`. This is only populated when creating a new key and `pgp_key` is supplied.
*
*/
@Export(name="encryptedPrivateKey", refs={String.class}, tree="[0]")
private Output encryptedPrivateKey;
/**
* @return the private key material, base 64 encoded and encrypted with the given `pgp_key`. This is only populated when creating a new key and `pgp_key` is supplied.
*
*/
public Output encryptedPrivateKey() {
return this.encryptedPrivateKey;
}
/**
* The MD5 public key fingerprint as specified in section 4 of RFC 4716.
*
*/
@Export(name="fingerprint", refs={String.class}, tree="[0]")
private Output fingerprint;
/**
* @return The MD5 public key fingerprint as specified in section 4 of RFC 4716.
*
*/
public Output fingerprint() {
return this.fingerprint;
}
/**
* The name of the Lightsail Key Pair. If omitted, a unique name will be generated by this provider
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the Lightsail Key Pair. If omitted, a unique name will be generated by this provider
*
*/
public Output name() {
return this.name;
}
@Export(name="namePrefix", refs={String.class}, tree="[0]")
private Output namePrefix;
public Output namePrefix() {
return this.namePrefix;
}
/**
* An optional PGP key to encrypt the resulting private key material. Only used when creating a new key pair
*
*/
@Export(name="pgpKey", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> pgpKey;
/**
* @return An optional PGP key to encrypt the resulting private key material. Only used when creating a new key pair
*
*/
public Output> pgpKey() {
return Codegen.optional(this.pgpKey);
}
/**
* the private key, base64 encoded. This is only populated when creating a new key, and when no `pgp_key` is provided.
*
*/
@Export(name="privateKey", refs={String.class}, tree="[0]")
private Output privateKey;
/**
* @return the private key, base64 encoded. This is only populated when creating a new key, and when no `pgp_key` is provided.
*
*/
public Output privateKey() {
return this.privateKey;
}
/**
* The public key material. This public key will be imported into Lightsail
*
*/
@Export(name="publicKey", refs={String.class}, tree="[0]")
private Output publicKey;
/**
* @return The public key material. This public key will be imported into Lightsail
*
*/
public Output publicKey() {
return this.publicKey;
}
/**
* A map of tags to assign to the collection. To create a key-only tag, use an empty string as the value. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*
* > **NOTE:** a PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted.`pgp_key` is ignored if `public_key` is supplied.
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return A map of tags to assign to the collection. To create a key-only tag, use an empty string as the value. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*
* > **NOTE:** a PGP key is not required, however it is strongly encouraged. Without a PGP key, the private key material will be stored in state unencrypted.`pgp_key` is ignored if `public_key` is supplied.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
* @deprecated
* Please use `tags` instead.
*
*/
@Deprecated /* Please use `tags` instead. */
@Export(name="tagsAll", refs={Map.class,String.class}, tree="[0,1,1]")
private Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy