» alicloud_key_pairs

This data source provides a list of key pairs in an Alibaba Cloud account according to the specified filters.

» Example Usage

# Declare the data source
resource "alicloud_key_pair" "default" {
  key_name = "keyPairDatasource"
data "alicloud_key_pairs" "default" {
  name_regex = "${alicloud_key_pair.default.key_name}"

» Argument Reference

The following arguments are supported:

  • name_regex - (Optional) A regex string to apply to the resulting key pairs.
  • ids - (Optional, Available 1.52.1+) A list of key pair IDs.
  • finger_print - (Optional) A finger print used to retrieve specified key pair.
  • output_file - (Optional) File name where to save data source results (after running terraform plan).
  • resource_group_id - (Optional, ForceNew, Available in 1.57.0+) The Id of resource group which the key pair belongs.

» Attributes Reference

The following attributes are exported in addition to the arguments listed above:

  • names - A list of key pair names.
  • key_pairs - A list of key pairs. Each element contains the following attributes: