-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a data source for host: `data/vcf_host`. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
- Loading branch information
1 parent
572b660
commit 52e758a
Showing
6 changed files
with
807 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "vcf_host Data Source - terraform-provider-vcf" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# vcf_host (Data Source) | ||
|
||
The `vcf_host` data source provides information about an ESXi host in a VMware Cloud Foundation environment. | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `fqdn` (String) The fully qualified domain name of the ESXi host. | ||
|
||
### Read-Only | ||
|
||
- `cluster` (List of Object) The cluster information of the ESXi host. (see [below for nested schema](#nestedatt--cluster)) | ||
- `cpu` (List of Object) The CPU information of the ESXi host. (see [below for nested schema](#nestedatt--cpu)) | ||
- `domain` (List of Object) The workload domain information of the ESXi host. (see [below for nested schema](#nestedatt--domain)) | ||
- `hardware` (List of Object) The hardware information of the ESXi host. (see [below for nested schema](#nestedatt--hardware)) | ||
- `id` (String) The ID of the ESXi host. | ||
- `ip_addresses` (List of Object) The IP addresses information of the ESXi host. (see [below for nested schema](#nestedatt--ip_addresses)) | ||
- `memory` (List of Object) The memory information of the ESXi host. (see [below for nested schema](#nestedatt--memory)) | ||
- `network_pool` (List of Object) The network pool associated with the ESXi host. (see [below for nested schema](#nestedatt--network_pool)) | ||
- `physical_nics` (List of Object) The physical NICs information of the ESXi host. (see [below for nested schema](#nestedatt--physical_nics)) | ||
- `status` (String) The status of the ESXi host. | ||
- `storage` (List of Object) The storage information of the ESXi host. (see [below for nested schema](#nestedatt--storage)) | ||
- `storage_type` (String) The storage type of the ESXi host. | ||
- `version` (String) The version of the ESXi running on the host. | ||
|
||
<a id="nestedatt--cluster"></a> | ||
|
||
### Nested Schema for `cluster` | ||
|
||
Read-Only: | ||
|
||
- `id` (String) | ||
|
||
<a id="nestedatt--cpu"></a> | ||
|
||
### Nested Schema for `cpu` | ||
|
||
Read-Only: | ||
|
||
- `cores` (Number) | ||
- `cpu_cores` (List of Object) (see [below for nested schema](#nestedobjatt--cpu--cpu_cores)) | ||
- `frequency_mhz` (Number) | ||
- `used_frequency_mhz` (Number) | ||
|
||
<a id="nestedobjatt--cpu--cpu_cores"></a> | ||
|
||
### Nested Schema for `cpu.cpu_cores` | ||
|
||
Read-Only: | ||
|
||
- `frequency_mhz` (Number) | ||
- `manufacturer` (String) | ||
- `model` (String) | ||
|
||
<a id="nestedatt--domain"></a> | ||
|
||
### Nested Schema for `domain` | ||
|
||
Read-Only: | ||
|
||
- `id` (String) | ||
- `name` (String) | ||
|
||
<a id="nestedatt--hardware"></a> | ||
|
||
### Nested Schema for `hardware` | ||
|
||
Read-Only: | ||
|
||
- `hybrid` (Boolean) | ||
- `model` (String) | ||
- `vendor` (String) | ||
|
||
<a id="nestedatt--ip_addresses"></a> | ||
|
||
### Nested Schema for `ip_addresses` | ||
|
||
Read-Only: | ||
|
||
- `ip_address` (String) | ||
- `type` (String) | ||
|
||
<a id="nestedatt--memory"></a> | ||
|
||
### Nested Schema for `memory` | ||
|
||
Read-Only: | ||
|
||
- `total_capacity_mb` (Number) | ||
- `used_capacity_mb` (Number) | ||
|
||
<a id="nestedatt--network_pool"></a> | ||
|
||
### Nested Schema for `network_pool` | ||
|
||
Read-Only: | ||
|
||
- `id` (String) | ||
- `name` (String) | ||
|
||
<a id="nestedatt--physical_nics"></a> | ||
|
||
### Nested Schema for `physical_nics` | ||
|
||
Read-Only: | ||
|
||
- `device_name` (String) | ||
- `mac_address` (String) | ||
- `speed` (Number) | ||
- `unit` (String) | ||
|
||
<a id="nestedatt--storage"></a> | ||
|
||
### Nested Schema for `storage` | ||
|
||
Read-Only: | ||
|
||
- `disks` (List of Object) (see [below for nested schema](#nestedobjatt--storage--disks)) | ||
- `total_capacity_mb` (Number) | ||
- `used_capacity_mb` (Number) | ||
|
||
<a id="nestedobjatt--storage--disks"></a> | ||
|
||
### Nested Schema for `storage.disks` | ||
|
||
Read-Only: | ||
|
||
- `capacity_mb` (Number) | ||
- `disk_type` (String) | ||
- `manufacturer` (String) | ||
- `model` (String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
variable "sddc_manager_host" { | ||
type = string | ||
description = "The fully qualified domain name of the SDDC Manager instance." | ||
} | ||
|
||
variable "sddc_manager_username" { | ||
type = string | ||
description = "The username to authenticate to the SDDC Manager instance." | ||
sensitive = true | ||
} | ||
|
||
variable "sddc_manager_password" { | ||
type = string | ||
description = "The password to authenticate to the SDDC Manager instance." | ||
sensitive = true | ||
} | ||
|
||
variable "host_fqdn" { | ||
type = string | ||
description = "The fully qualified domain name of the ESXi host." | ||
default = "sfo-w01-esx01.sfo.rainpole.io" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
terraform { | ||
required_providers { | ||
vcf = { | ||
source = "vmware/vcf" | ||
} | ||
} | ||
} | ||
|
||
provider "vcf" { | ||
sddc_manager_username = var.sddc_manager_username | ||
sddc_manager_password = var.sddc_manager_password | ||
sddc_manager_host = var.sddc_manager_host | ||
} | ||
|
||
data "vcf_host" "example" { | ||
fqdn = var.host_fqdn | ||
} | ||
|
||
output "host_id" { | ||
value = data.vcf_host.example.id | ||
} | ||
|
||
output "host_fqdn" { | ||
value = data.vcf_host.example.fqdn | ||
} | ||
|
||
output "host_hardware" { | ||
value = [ | ||
for hw in data.vcf_host.example.hardware : { | ||
hybrid = hw.hybrid | ||
model = hw.model | ||
vendor = hw.vendor | ||
} | ||
] | ||
} | ||
|
||
output "host_version" { | ||
value = data.vcf_host.example.version | ||
} | ||
|
||
output "host_status" { | ||
value = data.vcf_host.example.status | ||
} | ||
|
||
output "host_domain" { | ||
value = [ | ||
for domain in data.vcf_host.example.domain : { | ||
id = domain.id | ||
} | ||
] | ||
} | ||
|
||
output "host_cluster" { | ||
value = [ | ||
for cluster in data.vcf_host.example.cluster : { | ||
id = cluster.id | ||
} | ||
] | ||
} | ||
|
||
output "host_network_pool" { | ||
value = [ | ||
for pool in data.vcf_host.example.network_pool : { | ||
id = pool.id | ||
name = pool.name | ||
} | ||
] | ||
} | ||
|
||
output "host_cpu" { | ||
value = [ | ||
for cpu in coalesce(tolist(data.vcf_host.example.cpu), []) : { | ||
cores = cpu.cores | ||
frequency_mhz = cpu.frequency_mhz | ||
used_frequency_mhz = cpu.used_frequency_mhz | ||
cpu_cores = [ | ||
for core in coalesce(tolist(cpu.cpu_cores), []) : { | ||
frequency_mhz = core.frequency_mhz | ||
manufacturer = core.manufacturer | ||
model = core.model | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
||
output "host_memory" { | ||
value = [ | ||
for mem in data.vcf_host.example.memory : { | ||
total_capacity_mb = mem.total_capacity_mb | ||
used_capacity_mb = mem.used_capacity_mb | ||
} | ||
] | ||
} | ||
|
||
output "host_storage" { | ||
value = [ | ||
for storage in coalesce(tolist(data.vcf_host.example.storage), []) : { | ||
total_capacity_mb = storage.total_capacity_mb | ||
used_capacity_mb = storage.used_capacity_mb | ||
disks = [ | ||
for disk in coalesce(tolist(storage.disks), []) : { | ||
capacity_mb = disk.capacity_mb | ||
disk_type = disk.disk_type | ||
manufacturer = disk.manufacturer | ||
model = disk.model | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
||
output "host_physical_nics" { | ||
value = [ | ||
for nic in data.vcf_host.example.physical_nics : { | ||
device_name = nic.device_name | ||
mac_address = nic.mac_address | ||
speed = nic.speed | ||
unit = nic.unit | ||
} | ||
] | ||
} | ||
|
||
output "host_ip_addresses" { | ||
value = [ | ||
for ip in data.vcf_host.example.ip_addresses : { | ||
ip_address = ip.ip_address | ||
type = ip.type | ||
} | ||
] | ||
} |
Oops, something went wrong.