alicloud_key_pair
Provides a key pair resource.
Example Usage
Basic Usage
resource "alicloud_key_pair" "basic" { key_name = "terraform-test-key-pair" } // Using name prefix to build key pair resource "alicloud_key_pair" "prefix" { key_name_prefix = "terraform-test-key-pair-prefix" } // Import an existing public key to build a alicloud key pair resource "alicloud_key_pair" "publickey" { key_name = "my_public_key" public_key = "ssh-rsa AAAAB3Nza12345678qwertyuudsfsg" }
Argument Reference
The following arguments are supported:
-
key_name
- (Force new resource) The key pair's name. It is the only in one Alicloud account. -
key_name_prefix
- (Force new resource) The key pair name's prefix. It is conflict withkey_name
. If it is specified, terraform will using it to build the only key name. -
public_key
- (Force new resource) You can import an existing public key and using Alicloud key pair to manage it. -
key_file
- (Force new resource) The name of file to save your new key pair's private key. Strongly suggest you to specified it when you creating key pair, otherwise, you wouldn't get its private key ever.
NOTE: If
key_name
andkey_name_prefix
are not set, terraform will produce a specified ID to replace.
Attributes Reference
-
key_name
- The name of the key pair. -
fingerprint
The finger print of the key pair.
Import
Key pair can be imported using the name, e.g.
$ terraform import alicloud_key_pair.example my_public_key
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/alicloud/r/key_pair.html