alicloud_ecs_key_pair

Provides a ECS Key Pair resource.

For information about ECS Key Pair and how to use it, see What is Key Pair.

Example Usage

Basic Usage

resource "alicloud_ecs_key_pair" "example" {
  key_pair_name = "key_pair_name"
}

// Using name prefix to build key pair
resource "alicloud_ecs_key_pair" "prefix" {
  key_name_prefix = "terraform-test-key-pair-prefix"
}

// Import an existing public key to build a alicloud key pair
resource "alicloud_ecs_key_pair" "publickey" {
  key_pair_name = "my_public_key"
  public_key    = "ssh-rsa AAAAB3Nza12345678qwertyuudsfsg"
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

ECS Key Pair can be imported using the id, e.g.

$ terraform import alicloud_ecs_key_pair.example <key_name>