-
Notifications
You must be signed in to change notification settings - Fork 2
/
data_sources.tf
39 lines (33 loc) · 1.28 KB
/
data_sources.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
data "vsphere_datacenter" "dc" {
name = "${var.vsphere_datacenter}"
}
# Use count with tenary operator for conditional fetching of this data source
data "vsphere_compute_cluster" "cluster" {
count = "${var.vsphere_cluster != "" ? 1 : 0}"
name = "${var.vsphere_cluster}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
# Use count with tenary operator for conditional fetching of this data source
data "vsphere_host" "host" {
count = "${var.vsphere_host != "" ? 1 : 0}"
name = "${var.vsphere_host}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
# Use count with tenary operator for conditional fetching of this data source
data "vsphere_resource_pool" "pool" {
count = "${var.vsphere_resource_pool != "" ? 1 : 0}"
name = "${var.vsphere_resource_pool}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_datastore" "datastore" {
name = "${var.vsphere_datastore}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_network" "network" {
name = "${var.vsphere_network}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_virtual_machine" "template" {
name = "${var.vsphere_template}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}