alicloud_instances

The Instances data source list ECS instance resources according to their ID, name regex, image id, status and other fields.

Example Usage

data "alicloud_instances" "instances_ds" {
  name_regex = "web_server"
  status     = "Running"
}

output "first_instance_id" {
  value = "${data.alicloud_instances.instances_ds.instances.0.id}"
}

output "instance_ids" {
  value = "${data.alicloud_instances.instances_ds.ids}"
}

Argument Reference

The following arguments are supported:

  data "alicloud_instances" "taggedInstances" {
    tags = {
      tagKey1 = "tagValue1",
      tagKey2 = "tagValue2"
    }
  }

Attributes Reference

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