github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/r/lightsail_key_pair.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_lightsail_key_pair"
     4  sidebar_current: "docs-aws-resource-lightsail-key-pair"
     5  description: |-
     6    Provides an Lightsail Key Pair
     7  ---
     8  
     9  # aws\_lightsail\_key\_pair
    10  
    11  Provides a Lightsail Key Pair, for use with Lightsail Instances. These key pairs
    12  are seperate from EC2 Key Pairs, and must be created or imported for use with
    13  Lightsail.
    14  
    15  ~> **Note:** Lightsail is currently only supported in `us-east-1` region.
    16  
    17  ## Example Usage, creating a new Key Pair
    18  
    19  ```hcl
    20  # Create a new Lightsail Key Pair
    21  resource "aws_lightsail_key_pair" "lg_key_pair" {
    22    name = "lg_key_pair"
    23  }
    24  ```
    25  
    26  ## Create new Key Pair, encrypting the private key with a PGP Key
    27  
    28  ```hcl
    29  resource "aws_lightsail_key_pair" "lg_key_pair" {
    30    name    = "lg_key_pair"
    31    pgp_key = "keybase:keybaseusername"
    32  }
    33  ```
    34  
    35  ## Import an existing public key
    36  
    37  ```hcl
    38  resource "aws_lightsail_key_pair" "lg_key_pair" {
    39    name       = "importing"
    40    public_key = "${file("~/.ssh/id_rsa.pub")}"
    41  }
    42  ```
    43  
    44  ## Argument Reference
    45  
    46  The following arguments are supported:
    47  
    48  * `name` - (Optional) The name of the Lightsail Key Pair. If omitted, a unique
    49  name will be generated by Terraform
    50  * `pgp_key` – (Optional) An optional PGP key to encrypt the resulting private
    51  key material. Only used when creating a new key pair
    52  * `public_key` - (Required) The public key material. This public key will be
    53  imported into Lightsail
    54  
    55  ~> **NOTE:** a PGP key is not required, however it is strongly encouraged.
    56  Without a PGP key, the private key material will be stored in state unencrypted.
    57  `pgp_key` is ignored if `public_key` is supplied.
    58  
    59  ## Attributes Reference
    60  
    61  The following attributes are exported in addition to the arguments listed above:
    62  
    63  * `id` - The name used for this key pair
    64  * `arn` - The ARN of the Lightsail key pair
    65  * `fingerprint` - The MD5 public key fingerprint as specified in section 4 of RFC 4716.
    66  * `public_key` - the public key, base64 encoded
    67  * `private_key` - the private key, base64 encoded. This is only populated
    68  when creating a new key, and when no `pgp_key` is provided
    69  * `encrypted_private_key` – the private key material, base 64 encoded and
    70  encrypted with the given `pgp_key`. This is only populated when creating a new
    71  key and `pgp_key` is supplied
    72  * `encrypted_fingerprint` - The MD5 public key fingerprint for the encrypted
    73  private key
    74  
    75  ## Import
    76  
    77  Lightsail Key Pairs cannot be imported, because the private and public key are
    78  only available on initial creation.