Skip to content

Commit adf6714

Browse files
docs: vsphere_virtual_machine updated disks info (#2272)
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 <[email protected]>
1 parent c734c4d commit adf6714

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ DOCUMENTATION:
1313

1414
- `resource/vsphere_resource_pool`: Updates to include steps to create resource pool on standalone ESXi hosts.
1515
([#2264](https://github.com/hashicorp/terraform-provider-vsphere/pull/2264))
16+
- `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`.
17+
[#2272](https://github.com/hashicorp/terraform-provider-vsphere/pull/2272)
1618

1719
## 2.9.2 (September 16, 2024)
1820

website/docs/r/host.html.markdown

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ data "vsphere_datacenter" "datacenter" {
2323
}
2424
2525
data "vsphere_host_thumbprint" "thumbprint" {
26-
address = "esx-01.example.com"
26+
address = "esxi-01.example.com"
2727
insecure = true
2828
}
2929
3030
resource "vsphere_host" "esx-01" {
31-
hostname = "esx-01.example.com"
31+
hostname = "esxi-01.example.com"
3232
username = "root"
3333
password = "password"
3434
license = "00000-00000-00000-00000-00000"
@@ -50,12 +50,12 @@ data "vsphere_compute_cluster" "cluster" {
5050
}
5151
5252
data "vsphere_host_thumbprint" "thumbprint" {
53-
address = "esx-01.example.com"
53+
address = "esxi-01.example.com"
5454
insecure = true
5555
}
5656
5757
resource "vsphere_host" "esx-01" {
58-
hostname = "esx-01.example.com"
58+
hostname = "esxi-01.example.com"
5959
username = "root"
6060
password = "password"
6161
license = "00000-00000-00000-00000-00000"
@@ -143,7 +143,7 @@ data "vsphere_datacenter" "datacenter" {
143143
}
144144
145145
data "vsphere_host" "host" {
146-
name = "esx-01.example.com"
146+
name = "esxi-01.example.com"
147147
datacenter_id = data.vsphere_datacenter.datacenter.id
148148
}
149149
@@ -160,12 +160,12 @@ data "vsphere_datacenter" "datacenter" {
160160
}
161161
162162
data "vsphere_host_thumbprint" "thumbprint" {
163-
address = "esx-01.example.com"
163+
address = "esxi-01.example.com"
164164
insecure = true
165165
}
166166
167167
resource "vsphere_host" "esx-01" {
168-
hostname = "esx-01.example.com"
168+
hostname = "esxi-01.example.com"
169169
username = "root"
170170
password = "password"
171171
thumbprint = data.vsphere_host_thumbprint.thumbprint.id
@@ -177,7 +177,7 @@ resource "vsphere_host" "esx-01" {
177177

178178
```hcl
179179
resource "vsphere_host" "esx-01" {
180-
hostname = "esx-01.example.com"
180+
hostname = "esxi-01.example.com"
181181
username = "root"
182182
password = "password"
183183
license = "00000-00000-00000-00000-00000"
@@ -198,4 +198,4 @@ All information will be added to the Terraform state after import.
198198
terraform import vsphere_host.esx-01 host-123
199199
```
200200

201-
The above would import the host `esx-01.example.com` with the host ID `host-123`.
201+
The above would import the host `esxi-01.example.com` with the host ID `host-123`.

website/docs/r/resource_pool.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ data "vsphere_datacenter" "datacenter" {
8484
}
8585
8686
data "vsphere_host_thumbprint" "thumbprint" {
87-
address = "esx-01.example.com"
87+
address = "esxi-01.example.com"
8888
insecure = true
8989
}
9090
9191
resource "vsphere_host" "esx-01" {
92-
hostname = "esx-01.example.com"
92+
hostname = "esxi-01.example.com"
9393
username = "root"
9494
password = "password"
9595
license = "00000-00000-00000-00000-00000"

website/docs/r/virtual_machine.html.markdown

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ resource "vsphere_virtual_machine" "vm" {
104104
network_id = data.vsphere_network.network.id
105105
}
106106
disk {
107-
label = "disk0"
107+
label = "Hard Disk 1"
108108
size = 20
109109
}
110110
}
@@ -160,7 +160,7 @@ resource "vsphere_virtual_machine" "vm" {
160160
adapter_type = data.vsphere_virtual_machine.template.network_interface_types[0]
161161
}
162162
disk {
163-
label = "disk0"
163+
label = "Hard Disk 1"
164164
size = data.vsphere_virtual_machine.template.disks.0.size
165165
thin_provisioned = data.vsphere_virtual_machine.template.disks.0.thin_provisioned
166166
}
@@ -541,7 +541,7 @@ resource "vsphere_virtual_machine" "vm" {
541541
adapter_type = data.vsphere_virtual_machine.template.network_interface_types[0]
542542
}
543543
disk {
544-
name = "disk0"
544+
name = "Hard Disk 1"
545545
size = data.vsphere_virtual_machine.template_from_ovf.disks.0.size
546546
thin_provisioned = data.vsphere_virtual_machine.template_from_ovf.disks.0.thin_provisioned
547547
}
@@ -610,7 +610,7 @@ resource "vsphere_virtual_machine" "vm" {
610610
network_id = data.vsphere_network.network.id
611611
}
612612
disk {
613-
label = "disk0"
613+
label = "Hard Disk 1"
614614
size = 20
615615
}
616616
}
@@ -862,11 +862,11 @@ The following example demonstrates and abridged multi-disk configuration:
862862
resource "vsphere_virtual_machine" "vm" {
863863
# ... other configuration ...
864864
disk {
865-
label = "disk0"
865+
label = "Hard Disk 1"
866866
size = "10"
867867
}
868868
disk {
869-
label = "disk1"
869+
label = "Hard Disk 2"
870870
size = "100"
871871
unit_number = 1
872872
}
@@ -1545,12 +1545,12 @@ resource "vsphere_virtual_machine" "vm" {
15451545
# ... other configuration ...
15461546
datastore_id = data.vsphere_datastore.vm_datastore.id
15471547
disk {
1548-
label = "disk0"
1548+
label = "Hard Disk 1"
15491549
size = 10
15501550
}
15511551
disk {
15521552
datastore_id = data.vsphere_datastore.pinned_datastore.id
1553-
label = "disk1"
1553+
label = "Hard Disk 2"
15541554
size = 100
15551555
unit_number = 1
15561556
}
@@ -1661,7 +1661,9 @@ Many of the requirements for [cloning](#additional-requirements-and-notes-for-cl
16611661

16621662
The following requirements apply to import:
16631663

1664-
* 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`.
1664+
* 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`.
1665+
1666+
~> **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_`.
16651667

16661668
* 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.
16671669

0 commit comments

Comments
 (0)