Skip to content

Commit

Permalink
feat: add d/host
Browse files Browse the repository at this point in the history
Adds a data source for host: `data/vcf_host`.

Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
  • Loading branch information
tenthirtyam committed Aug 27, 2024
1 parent 0b6bd8a commit 000d1c7
Show file tree
Hide file tree
Showing 5 changed files with 686 additions and 0 deletions.
115 changes: 115 additions & 0 deletions docs/data-sources/host.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "vcf_host Data Source - terraform-provider-vcf"
subcategory: ""
description: |-
---

# Data Source: vcf_host

The `vcf_host` data source provides information about an ESXi host in a VMware Cloud Foundation environment.

## Schema

### Required

- `fqdn` (String) - The fully qualified domain name of the ESXi host.

### Read-Only

- `id` (String) - The ID of the ESXi host.
- `status` (String) - The status of the ESXi host.
- `version` (String) - The version of the ESXi running on the host.
- `storage_type` (String) - The storage type of the ESXi host.

### Nested Schema for `network_pool`

Read-Only:

- `name` (String) - The name of the network pool.
- `id` (String) - The ID of the network pool.

### Nested Schema for `cluster`

Read-Only:

- `id` (String) - The ID of the cluster.

### Nested Schema for `cpu`

Read-Only:

- `cores` (Number) - Number of CPU cores.
- `frequency_mhz` (Number) - Total CPU frequency in MHz.
- `used_frequency_mhz` (Number) - Used CPU frequency in MHz.
- `cpu_cores` (List of Object) - Information about each of the [CPU cores](#nestedobjatt--cpu--cpu_cores).

<a id="nestedobjatt--cpu--cpu_cores"></a>

#### Nested Schema for `cpu.cpu_cores`

Read-Only:

- `frequency` (Number) - The frequency of the CPU core in MHz.
- `manufacturer` (String) - The manufacturer of the CPU.
- `model` (String) - The model of the CPU.

<a id="nestedatt--domain"></a>

### Nested Schema for `domain`

Read-Only:

- `id` (String) - The ID of the workload domain.
- `name` (String) - The name of the workload domain.

### Nested Schema for `hardware`

Read-Only:

- `model` (String) - The hardware model of the ESXi host.
- `vendor` (String) - The hardware vendor of the ESXi host.
- `hybrid` (Boolean) - Indicates if the ESXi host is hybrid.

### Nested Schema for `ip_addresses`

Read-Only:

- `ip_address` (String) - The IP address.
- `type` (String) - The type of the IP address.

### Nested Schema for `memory`

Read-Only:

- `total_capacity_mb` (Number) - The total memory capacity in MB.
- `used_capacity_mb` (Number) - The used memory capacity in MB.

### Nested Schema for `storage`

Read-Only:

- `total_capacity_mb` (Number) - The total storage capacity in MB.
- `used_capacity_mb` (Number) - The used storage capacity in MB.
- `disks` (List of Object) - The disks information of the ESXi host (see [below for nested schema](#nestedobjatt--storage--disks)).

<a id="nestedobjatt--storage--disks"></a>

### Nested Schema for `storage.disks`

Read-Only:

- `capacity_mb` (Number) - The capacity of the disk in MB.
- `disk_type` (String) - The type of the disk.
- `manufacturer` (String) - The manufacturer of the disk.
- `model` (String) - The model of the disk.

### Nested Schema for `physical_nics`

Read-Only:

- `device_name` (String) - The device name of the NIC.
- `mac_address` (String) - The MAC address of the NIC.
- `speed` (Number) - The speed of the NIC.
- `unit` (String) - The unit of the NIC speed.
22 changes: 22 additions & 0 deletions examples/data-sources/host/variables.tf
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"
}
21 changes: 21 additions & 0 deletions examples/data-sources/host/vcf_host.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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
}
Loading

0 comments on commit 000d1c7

Please sign in to comment.