dtcloud_lb_vms (Data Source)
Lists the machines on a network that can be added to a pool as members.
This is the lookup the web console offers when you pick members, and it is what makes a for_each
member set possible without pasting ids.
Example Usage
# The machines on a network that can be added to a pool. This is the lookup the
# web console offers when you pick members, and it is what makes a `for_each`
# member set possible.
data "dtcloud_lb_vms" "candidates" {
network_id = dtcloud_network.app.id
}
output "candidates" {
# A machine can hold several addresses on one network, so `ip_addresses` is a list.
value = [for vm in data.dtcloud_lb_vms.candidates.vms : "${vm.name} ${join(",", vm.ip_addresses)}"]
}
Schema
Required
network_id(String) Network to look for candidate members on.
Optional
pool_id(String) When set, VMs already in this pool are left out of the result.
Read-Only
id(String) The ID of this resource.vms(List of Object) VMs attached to the network. (see below for nested schema)
Nested Schema for vms
Read-Only:
id(String)ip_address(String)ip_addresses(List of String)name(String)
Behaviour worth knowing
ip_addressesis a list, not a single field. The platform builds it from every port the machine holds on that network, and a machine with three addresses on one network is ordinary.ip_addressis the first of them; name the one you want indtcloud_lb_member.address.pool_idfilters out machines already in that pool, which is what keeps afor_eachset from proposing members that exist.