Skip to content

Commit

Permalink
docs: vsphere_virtual_machine updated disks info (#2272)
Browse files Browse the repository at this point in the history
Fixes examples of `disk0` to reflect that during import the disk will be set back to defaults like `Hard Disk 1` by vSphere.

Signed-off-by: Jared Burns <jared.burns@broadcom.com>
  • Loading branch information
burnsjared0415 authored Oct 8, 2024
1 parent c734c4d commit adf6714
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ DOCUMENTATION:

- `resource/vsphere_resource_pool`: Updates to include steps to create resource pool on standalone ESXi hosts.
([#2264](https://github.com/hashicorp/terraform-provider-vsphere/pull/2264))
- `resource/vsphere_virtual_machine`: Updates to fix examples of `disk0` to reflect that during import the disk get set back to default like `Hard Disk 1`.
[#2272](https://github.com/hashicorp/terraform-provider-vsphere/pull/2272)

## 2.9.2 (September 16, 2024)

Expand Down
18 changes: 9 additions & 9 deletions website/docs/r/host.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ data "vsphere_datacenter" "datacenter" {
}
data "vsphere_host_thumbprint" "thumbprint" {
address = "esx-01.example.com"
address = "esxi-01.example.com"
insecure = true
}
resource "vsphere_host" "esx-01" {
hostname = "esx-01.example.com"
hostname = "esxi-01.example.com"
username = "root"
password = "password"
license = "00000-00000-00000-00000-00000"
Expand All @@ -50,12 +50,12 @@ data "vsphere_compute_cluster" "cluster" {
}
data "vsphere_host_thumbprint" "thumbprint" {
address = "esx-01.example.com"
address = "esxi-01.example.com"
insecure = true
}
resource "vsphere_host" "esx-01" {
hostname = "esx-01.example.com"
hostname = "esxi-01.example.com"
username = "root"
password = "password"
license = "00000-00000-00000-00000-00000"
Expand Down Expand Up @@ -143,7 +143,7 @@ data "vsphere_datacenter" "datacenter" {
}
data "vsphere_host" "host" {
name = "esx-01.example.com"
name = "esxi-01.example.com"
datacenter_id = data.vsphere_datacenter.datacenter.id
}
Expand All @@ -160,12 +160,12 @@ data "vsphere_datacenter" "datacenter" {
}
data "vsphere_host_thumbprint" "thumbprint" {
address = "esx-01.example.com"
address = "esxi-01.example.com"
insecure = true
}
resource "vsphere_host" "esx-01" {
hostname = "esx-01.example.com"
hostname = "esxi-01.example.com"
username = "root"
password = "password"
thumbprint = data.vsphere_host_thumbprint.thumbprint.id
Expand All @@ -177,7 +177,7 @@ resource "vsphere_host" "esx-01" {

```hcl
resource "vsphere_host" "esx-01" {
hostname = "esx-01.example.com"
hostname = "esxi-01.example.com"
username = "root"
password = "password"
license = "00000-00000-00000-00000-00000"
Expand All @@ -198,4 +198,4 @@ All information will be added to the Terraform state after import.
terraform import vsphere_host.esx-01 host-123
```

The above would import the host `esx-01.example.com` with the host ID `host-123`.
The above would import the host `esxi-01.example.com` with the host ID `host-123`.
4 changes: 2 additions & 2 deletions website/docs/r/resource_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ data "vsphere_datacenter" "datacenter" {
}
data "vsphere_host_thumbprint" "thumbprint" {
address = "esx-01.example.com"
address = "esxi-01.example.com"
insecure = true
}
resource "vsphere_host" "esx-01" {
hostname = "esx-01.example.com"
hostname = "esxi-01.example.com"
username = "root"
password = "password"
license = "00000-00000-00000-00000-00000"
Expand Down
20 changes: 11 additions & 9 deletions website/docs/r/virtual_machine.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ resource "vsphere_virtual_machine" "vm" {
network_id = data.vsphere_network.network.id
}
disk {
label = "disk0"
label = "Hard Disk 1"
size = 20
}
}
Expand Down Expand Up @@ -160,7 +160,7 @@ resource "vsphere_virtual_machine" "vm" {
adapter_type = data.vsphere_virtual_machine.template.network_interface_types[0]
}
disk {
label = "disk0"
label = "Hard Disk 1"
size = data.vsphere_virtual_machine.template.disks.0.size
thin_provisioned = data.vsphere_virtual_machine.template.disks.0.thin_provisioned
}
Expand Down Expand Up @@ -541,7 +541,7 @@ resource "vsphere_virtual_machine" "vm" {
adapter_type = data.vsphere_virtual_machine.template.network_interface_types[0]
}
disk {
name = "disk0"
name = "Hard Disk 1"
size = data.vsphere_virtual_machine.template_from_ovf.disks.0.size
thin_provisioned = data.vsphere_virtual_machine.template_from_ovf.disks.0.thin_provisioned
}
Expand Down Expand Up @@ -610,7 +610,7 @@ resource "vsphere_virtual_machine" "vm" {
network_id = data.vsphere_network.network.id
}
disk {
label = "disk0"
label = "Hard Disk 1"
size = 20
}
}
Expand Down Expand Up @@ -862,11 +862,11 @@ The following example demonstrates and abridged multi-disk configuration:
resource "vsphere_virtual_machine" "vm" {
# ... other configuration ...
disk {
label = "disk0"
label = "Hard Disk 1"
size = "10"
}
disk {
label = "disk1"
label = "Hard Disk 2"
size = "100"
unit_number = 1
}
Expand Down Expand Up @@ -1545,12 +1545,12 @@ resource "vsphere_virtual_machine" "vm" {
# ... other configuration ...
datastore_id = data.vsphere_datastore.vm_datastore.id
disk {
label = "disk0"
label = "Hard Disk 1"
size = 10
}
disk {
datastore_id = data.vsphere_datastore.pinned_datastore.id
label = "disk1"
label = "Hard Disk 2"
size = 100
unit_number = 1
}
Expand Down Expand Up @@ -1661,7 +1661,9 @@ Many of the requirements for [cloning](#additional-requirements-and-notes-for-cl

The following requirements apply to import:

* The disks must have a [`label`](#label) argument assigned in a convention matching `diskN`, starting with disk number 0, based on each virtual disk order on the SCSI bus. As an example, a disk on SCSI controller `0` with a unit number of `0` would be labeled as `disk0`, a disk on the same controller with a unit number of `1` would be `disk1`, but the next disk, which is on SCSI controller `1` with a unit number of `0`, still becomes `disk2`.
* The disks must have a [`label`](#label) argument assigned in a convention matching `Hard Disk`, starting with disk number 0, based on each virtual disk order on the SCSI bus. As an example, a disk on SCSI controller `0` with a unit number of `0` would be labeled as `Hard Disk 0`, a disk on the same controller with a unit number of `1` would be `Hard Disk 1`, but the next disk, which is on SCSI controller `1` with a unit number of `0`, still becomes `Hard Disk 2`.

~> **NOTE:** Any custom `label` set at deployment of machine through Terraform, on import will not have the custom `label` and will default to `Hard Disk _x_`.

* Disks are always imported with [`keep_on_remove`](#keep_on_remove) enabled until the first `terraform apply` run which will remove the setting for known disks. This process safeguards against naming or accounting mistakes in the disk configuration.

Expand Down

0 comments on commit adf6714

Please sign in to comment.