@pulumi/vsphere 4.16.2 → 4.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/computeCluster.d.ts +137 -67
  2. package/computeCluster.js +92 -46
  3. package/computeCluster.js.map +1 -1
  4. package/computeClusterHostGroup.d.ts +45 -25
  5. package/computeClusterHostGroup.js +21 -13
  6. package/computeClusterHostGroup.js.map +1 -1
  7. package/computeClusterVmAffinityRule.d.ts +32 -20
  8. package/computeClusterVmAffinityRule.js +20 -14
  9. package/computeClusterVmAffinityRule.js.map +1 -1
  10. package/computeClusterVmAntiAffinityRule.d.ts +40 -13
  11. package/computeClusterVmAntiAffinityRule.js +28 -7
  12. package/computeClusterVmAntiAffinityRule.js.map +1 -1
  13. package/computeClusterVmDependencyRule.d.ts +32 -24
  14. package/computeClusterVmDependencyRule.js +20 -18
  15. package/computeClusterVmDependencyRule.js.map +1 -1
  16. package/computeClusterVmGroup.d.ts +32 -23
  17. package/computeClusterVmGroup.js +8 -11
  18. package/computeClusterVmGroup.js.map +1 -1
  19. package/computeClusterVmHostRule.d.ts +36 -26
  20. package/computeClusterVmHostRule.js +24 -20
  21. package/computeClusterVmHostRule.js.map +1 -1
  22. package/configurationProfile.d.ts +88 -0
  23. package/configurationProfile.js +88 -0
  24. package/configurationProfile.js.map +1 -1
  25. package/contentLibrary.d.ts +6 -4
  26. package/contentLibrary.js +3 -1
  27. package/contentLibrary.js.map +1 -1
  28. package/contentLibraryItem.d.ts +3 -2
  29. package/contentLibraryItem.js +3 -2
  30. package/contentLibraryItem.js.map +1 -1
  31. package/customAttribute.d.ts +2 -3
  32. package/customAttribute.js +2 -3
  33. package/customAttribute.js.map +1 -1
  34. package/datacenter.d.ts +18 -8
  35. package/datacenter.js +4 -3
  36. package/datacenter.js.map +1 -1
  37. package/datastoreCluster.d.ts +37 -25
  38. package/datastoreCluster.js +10 -10
  39. package/datastoreCluster.js.map +1 -1
  40. package/datastoreClusterVmAntiAffinityRule.d.ts +37 -22
  41. package/datastoreClusterVmAntiAffinityRule.js +13 -13
  42. package/datastoreClusterVmAntiAffinityRule.js.map +1 -1
  43. package/distributedPortGroup.d.ts +19 -9
  44. package/distributedPortGroup.js +7 -6
  45. package/distributedPortGroup.js.map +1 -1
  46. package/distributedVirtualSwitch.d.ts +27 -10
  47. package/distributedVirtualSwitch.js +3 -4
  48. package/distributedVirtualSwitch.js.map +1 -1
  49. package/dpmHostOverride.d.ts +21 -16
  50. package/dpmHostOverride.js +9 -10
  51. package/dpmHostOverride.js.map +1 -1
  52. package/drsVmOverride.d.ts +22 -17
  53. package/drsVmOverride.js +10 -11
  54. package/drsVmOverride.js.map +1 -1
  55. package/entityPermissions.d.ts +58 -0
  56. package/entityPermissions.js +58 -0
  57. package/entityPermissions.js.map +1 -1
  58. package/file.d.ts +15 -0
  59. package/file.js +15 -0
  60. package/file.js.map +1 -1
  61. package/folder.d.ts +37 -19
  62. package/folder.js +7 -10
  63. package/folder.js.map +1 -1
  64. package/getComputeCluster.d.ts +35 -19
  65. package/getComputeCluster.js +24 -10
  66. package/getComputeCluster.js.map +1 -1
  67. package/getCustomAttribute.d.ts +10 -6
  68. package/getCustomAttribute.js +10 -6
  69. package/getCustomAttribute.js.map +1 -1
  70. package/getDatacenter.d.ts +10 -6
  71. package/getDatacenter.js +10 -6
  72. package/getDatacenter.js.map +1 -1
  73. package/getDatastore.d.ts +22 -16
  74. package/getDatastore.js +12 -8
  75. package/getDatastore.js.map +1 -1
  76. package/getDatastoreCluster.d.ts +24 -10
  77. package/getDatastoreCluster.js +20 -6
  78. package/getDatastoreCluster.js.map +1 -1
  79. package/getDistributedVirtualSwitch.d.ts +25 -19
  80. package/getDistributedVirtualSwitch.js +12 -8
  81. package/getDistributedVirtualSwitch.js.map +1 -1
  82. package/getHost.d.ts +23 -13
  83. package/getHost.js +8 -4
  84. package/getHost.js.map +1 -1
  85. package/getNetwork.d.ts +12 -8
  86. package/getNetwork.js.map +1 -1
  87. package/getOvfVmTemplate.d.ts +276 -0
  88. package/getOvfVmTemplate.js +276 -0
  89. package/getOvfVmTemplate.js.map +1 -1
  90. package/getResourcePool.d.ts +38 -26
  91. package/getResourcePool.js +16 -8
  92. package/getResourcePool.js.map +1 -1
  93. package/getTag.d.ts +14 -10
  94. package/getTag.js +14 -10
  95. package/getTag.js.map +1 -1
  96. package/getTagCategory.d.ts +8 -4
  97. package/getTagCategory.js +8 -4
  98. package/getTagCategory.js.map +1 -1
  99. package/getVappContainer.d.ts +16 -6
  100. package/getVappContainer.js +6 -2
  101. package/getVappContainer.js.map +1 -1
  102. package/getVirtualMachine.d.ts +58 -36
  103. package/getVirtualMachine.js +10 -6
  104. package/getVirtualMachine.js.map +1 -1
  105. package/getVmfsDisks.d.ts +12 -4
  106. package/getVmfsDisks.js +6 -2
  107. package/getVmfsDisks.js.map +1 -1
  108. package/haVmOverride.d.ts +8 -10
  109. package/haVmOverride.js +8 -10
  110. package/haVmOverride.js.map +1 -1
  111. package/host.d.ts +54 -80
  112. package/host.js +54 -80
  113. package/host.js.map +1 -1
  114. package/hostPortGroup.d.ts +21 -11
  115. package/hostPortGroup.js +8 -4
  116. package/hostPortGroup.js.map +1 -1
  117. package/hostVirtualSwitch.d.ts +21 -17
  118. package/hostVirtualSwitch.js +9 -11
  119. package/hostVirtualSwitch.js.map +1 -1
  120. package/nasDatastore.d.ts +48 -35
  121. package/nasDatastore.js +9 -8
  122. package/nasDatastore.js.map +1 -1
  123. package/package.json +2 -2
  124. package/resourcePool.d.ts +31 -7
  125. package/resourcePool.js +13 -1
  126. package/resourcePool.js.map +1 -1
  127. package/role.d.ts +31 -2
  128. package/role.js +31 -2
  129. package/role.js.map +1 -1
  130. package/storageDrsVmOverride.d.ts +40 -17
  131. package/storageDrsVmOverride.js +19 -8
  132. package/storageDrsVmOverride.js.map +1 -1
  133. package/tag.d.ts +16 -15
  134. package/tag.js +16 -15
  135. package/tag.js.map +1 -1
  136. package/tagCategory.d.ts +2 -3
  137. package/tagCategory.js +2 -3
  138. package/tagCategory.js.map +1 -1
  139. package/types/input.d.ts +5 -3
  140. package/types/output.d.ts +5 -3
  141. package/vappContainer.d.ts +21 -12
  142. package/vappContainer.js +0 -3
  143. package/vappContainer.js.map +1 -1
  144. package/vappEntity.d.ts +14 -11
  145. package/vappEntity.js +2 -5
  146. package/vappEntity.js.map +1 -1
  147. package/virtualDisk.d.ts +18 -10
  148. package/virtualDisk.js +9 -7
  149. package/virtualDisk.js.map +1 -1
  150. package/virtualMachine.d.ts +1102 -10
  151. package/virtualMachine.js +1056 -6
  152. package/virtualMachine.js.map +1 -1
  153. package/virtualMachineSnapshot.d.ts +2 -1
  154. package/virtualMachineSnapshot.js +2 -1
  155. package/virtualMachineSnapshot.js.map +1 -1
  156. package/vmfsDatastore.d.ts +54 -42
  157. package/vmfsDatastore.js +12 -15
  158. package/vmfsDatastore.js.map +1 -1
  159. package/vnic.d.ts +4 -3
  160. package/vnic.js +4 -3
  161. package/vnic.js.map +1 -1
package/virtualMachine.js CHANGED
@@ -6,27 +6,1077 @@ exports.VirtualMachine = void 0;
6
6
  const pulumi = require("@pulumi/pulumi");
7
7
  const utilities = require("./utilities");
8
8
  /**
9
+ * The `vsphere.VirtualMachine` resource is used to manage the lifecycle of a virtual machine.
10
+ *
11
+ * For details on working with virtual machines in VMware vSphere, please refer to the [product documentation][vmware-docs-vm-management].
12
+ *
13
+ * [vmware-docs-vm-management]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-virtual-machine-administration-guide-8-0.html
14
+ *
15
+ * ## About Working with Virtual Machines in Terraform
16
+ *
17
+ * A high degree of control and flexibility is available to a vSphere administrator to configure, deploy, and manage virtual machines. The Terraform provider enables you to manage the desired state of virtual machine resources.
18
+ *
19
+ * This section provides information on configurations you should consider when setting up virtual machines, creating templates for cloning, and more.
20
+ *
21
+ * ### Disks
22
+ *
23
+ * The `vsphere.VirtualMachine` resource supports standard VMDK-backed virtual disks. It **does not** support raw device mappings (RDMs) to proxy use of raw physical storage device
24
+ *
25
+ * Disks are managed by a label supplied to the `label` attribute in a `disk` block. This is separate from the automatic naming that vSphere assigns when a virtual machine is created. Control of the name for a virtual disk is not supported unless you are attaching an external disk with the `attach` attribute.
26
+ *
27
+ * Virtual disks can be SCSI, SATA, NVMe or IDE. The storage controllers managed by the Terraform provider can vary, depending on the value supplied to `scsiControllerCount`, `sataControllerCount`, `nvmeControllerCount`, or `ideControllerCount`. This also dictates the controllers that are checked when looking for disks during a cloning process. SCSI controllers are all configured with the controller type defined by the `scsiType` setting. If you are cloning from a template, devices will be added or re-configured as necessary.
28
+ *
29
+ * When cloning from a template, you must specify disks of either the same or greater size than the disks in the source template or the same size when cloning from a snapshot (also known as a linked clone).
30
+ *
31
+ * See the section on Creating a Virtual Machine from a Template for more information.
32
+ *
33
+ * ### Customization and Network Waiters
34
+ *
35
+ * Terraform waits during various parts of a virtual machine deployment to ensure that the virtual machine is in an expected state before proceeding. These events occur when a virtual machine is created or updated, depending on the waiter.
36
+ *
37
+ * The waiters include the following:
38
+ *
39
+ * * **Customization Waiter**:
40
+ *
41
+ * This waiter watches events in vSphere to monitor when customization on a virtual machine completes during creation. Depending on your vSphere or virtual machine configuration, it may be necessary to change the timeout or turn off the waiter. This can be controlled by using the `timeout` setting in the customization settings block.
42
+ *
43
+ * * **Network Waiter**:
44
+ *
45
+ * This waiter waits for interfaces to appear on a virtual machine guest operating system and occurs close to the end of both virtual machine creation and update. This waiter ensures that the IP information gets reported to the guest operating system, mainly to facilitate the availability of a valid, reachable default IP address for any provisioners.
46
+ *
47
+ * The behavior of the waiter can be controlled with the `waitForGuestNetTimeout`, `waitForGuestNetRoutable`, `waitForGuestIpTimeout`, and `ignoredGuestIps` settings.
48
+ *
49
+ * ## Example Usage
50
+ *
51
+ * ### Creating a Virtual Machine
52
+ *
53
+ * The following block contains the option necessary to create a virtual machine, with a single disk and network interface.
54
+ *
55
+ * In this example, the resource makes use of the following data sources:
56
+ *
57
+ * * [`vsphere.Datacenter`][tf-vsphere-datacenter] to locate the datacenter,
58
+ *
59
+ * * [`vsphere.getDatastore`][tf-vsphere-datastore] to locate the default datastore to place the virtual machine files,
60
+ *
61
+ * * [`vsphere_compute-cluster`][tf-vsphere-compute-cluster] to locate a resource pool located in a cluster or standalone host, and
62
+ *
63
+ * * [`vsphere.getNetwork`][tf-vsphere-network] to locate the network.
64
+ *
65
+ * [tf-vsphere-datacenter]: /docs/providers/vsphere/d/datacenter.html
66
+ * [tf-vsphere-datastore]: /docs/providers/vsphere/d/datastore.html
67
+ * [tf-vsphere-compute-cluster]: /docs/providers/vsphere/d/compute-cluster.html
68
+ * [tf-vsphere-network]: /docs/providers/vsphere/d/network.html
69
+ *
70
+ * **Example**:
71
+ *
72
+ * ```typescript
73
+ * import * as pulumi from "@pulumi/pulumi";
74
+ * import * as vsphere from "@pulumi/vsphere";
75
+ *
76
+ * const datacenter = vsphere.getDatacenter({
77
+ * name: "dc-01",
78
+ * });
79
+ * const datastore = datacenter.then(datacenter => vsphere.getDatastore({
80
+ * name: "datastore-01",
81
+ * datacenterId: datacenter.id,
82
+ * }));
83
+ * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({
84
+ * name: "cluster-01",
85
+ * datacenterId: datacenter.id,
86
+ * }));
87
+ * const network = datacenter.then(datacenter => vsphere.getNetwork({
88
+ * name: "VM Network",
89
+ * datacenterId: datacenter.id,
90
+ * }));
91
+ * const vm = new vsphere.VirtualMachine("vm", {
92
+ * name: "foo",
93
+ * resourcePoolId: cluster.then(cluster => cluster.resourcePoolId),
94
+ * datastoreId: datastore.then(datastore => datastore.id),
95
+ * numCpus: 1,
96
+ * memory: 1024,
97
+ * guestId: "otherLinux64Guest",
98
+ * networkInterfaces: [{
99
+ * networkId: network.then(network => network.id),
100
+ * }],
101
+ * disks: [{
102
+ * label: "Hard Disk 1",
103
+ * size: 20,
104
+ * }],
105
+ * });
106
+ * ```
107
+ *
108
+ * ### Cloning and Customization
109
+ *
110
+ * Building on the above example, the below configuration creates a virtual machine by cloning it from a template, fetched using the [`vsphere.VirtualMachine`][tf-vsphere-virtual-machine-ds] data source. This option allows you to locate the UUID of the template to clone, along with settings for network interface type, SCSI bus type, and disk attributes.
111
+ *
112
+ * [tf-vsphere-virtual-machine-ds]: /docs/providers/vsphere/d/virtual_machine.html
113
+ *
114
+ * > **NOTE:** Cloning requires vCenter Server and is not supported on direct ESXi host connections.
115
+ *
116
+ * **Examples**:
117
+ *
118
+ * This example clones a Linux template and customizes with the provided settings:
119
+ *
120
+ * ```typescript
121
+ * import * as pulumi from "@pulumi/pulumi";
122
+ * import * as vsphere from "@pulumi/vsphere";
123
+ *
124
+ * const datacenter = vsphere.getDatacenter({
125
+ * name: "dc-01",
126
+ * });
127
+ * const datastore = datacenter.then(datacenter => vsphere.getDatastore({
128
+ * name: "datastore-01",
129
+ * datacenterId: datacenter.id,
130
+ * }));
131
+ * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({
132
+ * name: "cluster-01",
133
+ * datacenterId: datacenter.id,
134
+ * }));
135
+ * const network = datacenter.then(datacenter => vsphere.getNetwork({
136
+ * name: "VM Network",
137
+ * datacenterId: datacenter.id,
138
+ * }));
139
+ * const template = datacenter.then(datacenter => vsphere.getVirtualMachine({
140
+ * name: "linux-template",
141
+ * datacenterId: datacenter.id,
142
+ * }));
143
+ * const vm = new vsphere.VirtualMachine("vm", {
144
+ * name: "foo",
145
+ * resourcePoolId: cluster.then(cluster => cluster.resourcePoolId),
146
+ * datastoreId: datastore.then(datastore => datastore.id),
147
+ * numCpus: 1,
148
+ * memory: 1024,
149
+ * guestId: template.then(template => template.guestId),
150
+ * scsiType: template.then(template => template.scsiType),
151
+ * networkInterfaces: [{
152
+ * networkId: network.then(network => network.id),
153
+ * adapterType: template.then(template => template.networkInterfaceTypes?.[0]),
154
+ * }],
155
+ * disks: [{
156
+ * label: "Hard Disk 1",
157
+ * size: template.then(template => template.disks?.[0]?.size),
158
+ * thinProvisioned: template.then(template => template.disks?.[0]?.thinProvisioned),
159
+ * }],
160
+ * clone: {
161
+ * templateUuid: template.then(template => template.id),
162
+ * customize: {
163
+ * linuxOptions: {
164
+ * hostName: "foo",
165
+ * domain: "example.com",
166
+ * },
167
+ * },
168
+ * },
169
+ * });
170
+ * ```
171
+ *
172
+ * This example uses the same structure as the previous example, but customizes with an existing guest customization specification:
173
+ *
174
+ * ```typescript
175
+ * import * as pulumi from "@pulumi/pulumi";
176
+ * import * as vsphere from "@pulumi/vsphere";
177
+ *
178
+ * // ... other configuration ...
179
+ * const linux = vsphere.getGuestOsCustomization({
180
+ * name: "linux",
181
+ * });
182
+ * const vm = new vsphere.VirtualMachine("vm", {
183
+ * templateUuid: template.id,
184
+ * customizationSpec: [{
185
+ * id: linux.then(linux => linux.id),
186
+ * }],
187
+ * });
188
+ * ```
189
+ *
190
+ * ### Deploying Virtual Machines from OVF/OVA
191
+ *
192
+ * Virtual machines can be deployed from OVF/OVA using either the local path and remote URL and the `ovfDeploy` property. When deploying from a local path, the path to the OVF/OVA must be provided. While deploying OVF, all other necessary files (_e.g._ `.vmdk`, `.mf`, etc) must be present in the same directory as the `.ovf` file.
193
+ *
194
+ * > **NOTE:** The vApp properties which are pre-defined in an OVF template can be overwritten. New vApp properties can not be created for an existing OVF template.
195
+ *
196
+ * > **NOTE:** An OVF/OVA deployment requires vCenter Server and is not supported on direct ESXi host connections.
197
+ *
198
+ * The following example demonstrates a scenario deploying a simple OVF/OVA, using both the local path and remote URL options.
199
+ *
200
+ * **Example**:
201
+ *
202
+ * ```typescript
203
+ * import * as pulumi from "@pulumi/pulumi";
204
+ * import * as std from "@pulumi/std";
205
+ * import * as vsphere from "@pulumi/vsphere";
206
+ *
207
+ * const datacenter = vsphere.getDatacenter({
208
+ * name: "dc-01",
209
+ * });
210
+ * const datastore = datacenter.then(datacenter => vsphere.getDatastore({
211
+ * name: "datastore-01",
212
+ * datacenterId: datacenter.id,
213
+ * }));
214
+ * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({
215
+ * name: "cluster-01",
216
+ * datacenterId: datacenter.id,
217
+ * }));
218
+ * const _default = Promise.all([cluster, datacenter]).then(([cluster, datacenter]) => vsphere.getResourcePool({
219
+ * name: std.index.format({
220
+ * input: "%s%s",
221
+ * args: [
222
+ * cluster.name,
223
+ * "/Resources",
224
+ * ],
225
+ * }).result,
226
+ * datacenterId: datacenter.id,
227
+ * }));
228
+ * const host = datacenter.then(datacenter => vsphere.getHost({
229
+ * name: "esxi-01.example.com",
230
+ * datacenterId: datacenter.id,
231
+ * }));
232
+ * const network = datacenter.then(datacenter => vsphere.getNetwork({
233
+ * name: "172.16.11.0",
234
+ * datacenterId: datacenter.id,
235
+ * }));
236
+ * //# Deployment of VM from Remote OVF
237
+ * const vmFromRemoteOvf = new vsphere.VirtualMachine("vmFromRemoteOvf", {
238
+ * name: "remote-foo",
239
+ * datacenterId: datacenter.then(datacenter => datacenter.id),
240
+ * datastoreId: datastore.then(datastore => datastore.i),
241
+ * resourcePoolId: _default.then(_default => _default.id),
242
+ * waitForGuestNetTimeout: 0,
243
+ * waitForGuestIpTimeout: 0,
244
+ * ovfDeploy: {
245
+ * allowUnverifiedSslCert: false,
246
+ * remoteOvfUrl: "https://example.com/foo.ova",
247
+ * diskProvisioning: "thin",
248
+ * ipProtocol: "IPV4",
249
+ * ipAllocationPolicy: "STATIC_MANUAL",
250
+ * ovfNetworkMap: {
251
+ * "Network 1": network.then(network => network.id),
252
+ * "Network 2": network.then(network => network.id),
253
+ * },
254
+ * },
255
+ * vapp: {
256
+ * properties: {
257
+ * "guestinfo.hostname": "remote-foo.example.com",
258
+ * "guestinfo.ipaddress": "172.16.11.101",
259
+ * "guestinfo.netmask": "255.255.255.0",
260
+ * "guestinfo.gateway": "172.16.11.1",
261
+ * "guestinfo.dns": "172.16.11.4",
262
+ * "guestinfo.domain": "example.com",
263
+ * "guestinfo.ntp": "ntp.example.com",
264
+ * "guestinfo.password": "VMware1!",
265
+ * "guestinfo.ssh": "True",
266
+ * },
267
+ * },
268
+ * });
269
+ * //# Deployment of VM from Local OVF
270
+ * const vmFromLocalOvf = new vsphere.VirtualMachine("vmFromLocalOvf", {
271
+ * name: "local-foo",
272
+ * datacenterId: datacenter.then(datacenter => datacenter.id),
273
+ * datastoreId: datastore.then(datastore => datastore.id),
274
+ * resourcePoolId: _default.then(_default => _default.id),
275
+ * waitForGuestNetTimeout: 0,
276
+ * waitForGuestIpTimeout: 0,
277
+ * ovfDeploy: {
278
+ * allowUnverifiedSslCert: false,
279
+ * localOvfPath: "/Volume/Storage/OVAs/foo.ova",
280
+ * diskProvisioning: "thin",
281
+ * ipProtocol: "IPV4",
282
+ * ipAllocationPolicy: "STATIC_MANUAL",
283
+ * ovfNetworkMap: {
284
+ * "Network 1": network.then(network => network.id),
285
+ * "Network 2": network.then(network => network.id),
286
+ * },
287
+ * },
288
+ * vapp: {
289
+ * properties: {
290
+ * "guestinfo.hostname": "local-foo.example.com",
291
+ * "guestinfo.ipaddress": "172.16.11.101",
292
+ * "guestinfo.netmask": "255.255.255.0",
293
+ * "guestinfo.gateway": "172.16.11.1",
294
+ * "guestinfo.dns": "172.16.11.4",
295
+ * "guestinfo.domain": "example.com",
296
+ * "guestinfo.ntp": "ntp.example.com",
297
+ * "guestinfo.password": "VMware1!",
298
+ * "guestinfo.ssh": "True",
299
+ * },
300
+ * },
301
+ * });
302
+ * ```
303
+ *
304
+ * In some scenarios, the Terraform provider may attempt to apply only the default settings. A virtual machine deployed directly from an OVF/OVA may not match the OVF specification. For example, if the `scsiType` option is not included in a `vsphere.VirtualMachine` resource, the provider will apply a default value of `pvscsi` and the virtual machine may not boot. In this scenario, use the `vsphere.getOvfVmTemplate` data source to parse the OVF properties and use the property value as parameters for the `vsphere.VirtualMachine` resource.
305
+ *
306
+ * The following example demonstrates a scenario deploying a nested ESXi host from an OVF/OVA, using the remote URL and local path options.
307
+ *
308
+ * **Example**:
309
+ *
310
+ * ```typescript
311
+ * import * as pulumi from "@pulumi/pulumi";
312
+ * import * as std from "@pulumi/std";
313
+ * import * as vsphere from "@pulumi/vsphere";
314
+ *
315
+ * const datacenter = vsphere.getDatacenter({
316
+ * name: "dc-01",
317
+ * });
318
+ * const datastore = datacenter.then(datacenter => vsphere.getDatastore({
319
+ * name: "datastore-01",
320
+ * datacenterId: datacenter.id,
321
+ * }));
322
+ * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({
323
+ * name: "cluster-01",
324
+ * datacenterId: datacenter.id,
325
+ * }));
326
+ * const _default = Promise.all([cluster, datacenter]).then(([cluster, datacenter]) => vsphere.getResourcePool({
327
+ * name: std.index.format({
328
+ * input: "%s%s",
329
+ * args: [
330
+ * cluster.name,
331
+ * "/Resources",
332
+ * ],
333
+ * }).result,
334
+ * datacenterId: datacenter.id,
335
+ * }));
336
+ * const host = datacenter.then(datacenter => vsphere.getHost({
337
+ * name: "esxi-01.example.com",
338
+ * datacenterId: datacenter.id,
339
+ * }));
340
+ * const network = datacenter.then(datacenter => vsphere.getNetwork({
341
+ * name: "172.16.11.0",
342
+ * datacenterId: datacenter.id,
343
+ * }));
344
+ * //# Remote OVF/OVA Source
345
+ * const ovfRemote = Promise.all([_default, datastore, network]).then(([_default, datastore, network]) => vsphere.getOvfVmTemplate({
346
+ * name: "ubuntu-xx.xx-server-cloudimg-amd64.ova",
347
+ * diskProvisioning: "thin",
348
+ * resourcePoolId: _default.id,
349
+ * datastoreId: datastore.id,
350
+ * remoteOvfUrl: "https://cloud-images.ubuntu.com/releases/xx.xx/release/ubuntu-xx.xx-server-cloudimg-amd64.ova",
351
+ * ovfNetworkMap: {
352
+ * "VM Network": network.id,
353
+ * },
354
+ * }));
355
+ * //# Local OVF/OVA Source
356
+ * const ovfLocal = Promise.all([_default, datastore, network]).then(([_default, datastore, network]) => vsphere.getOvfVmTemplate({
357
+ * name: "ubuntu-xx.xx-server-cloudimg-amd64.ova",
358
+ * diskProvisioning: "thin",
359
+ * resourcePoolId: _default.id,
360
+ * datastoreId: datastore.id,
361
+ * localOvfPath: "/Volume/Storage/OVA/ubuntu-xx-xx-server-cloudimg-amd64.ova",
362
+ * ovfNetworkMap: {
363
+ * "VM Network": network.id,
364
+ * },
365
+ * }));
366
+ * //# Deployment of VM from Remote OVF
367
+ * const vmFromRemoteOvf = new vsphere.VirtualMachine("vmFromRemoteOvf", {
368
+ * networkInterfaces: .map(entry => ({
369
+ * networkId: entry.value,
370
+ * })),
371
+ * name: "ubuntu-server-cloud-image-01",
372
+ * datacenterId: datacenter.then(datacenter => datacenter.id),
373
+ * datastoreId: datastore.then(datastore => datastore.id),
374
+ * resourcePoolId: _default.then(_default => _default.id),
375
+ * numCpus: ovfRemote.then(ovfRemote => ovfRemote.numCpus),
376
+ * numCoresPerSocket: ovfRemote.then(ovfRemote => ovfRemote.numCoresPerSocket),
377
+ * memory: ovfRemote.then(ovfRemote => ovfRemote.memory),
378
+ * guestId: ovfRemote.then(ovfRemote => ovfRemote.guestId),
379
+ * firmware: ovfRemote.then(ovfRemote => ovfRemote.firmware),
380
+ * scsiType: ovfRemote.then(ovfRemote => ovfRemote.scsiType),
381
+ * waitForGuestNetTimeout: 0,
382
+ * waitForGuestIpTimeout: 0,
383
+ * ovfDeploy: {
384
+ * remoteOvfUrl: "https://cloud-images.ubuntu.com/releases/xx.xx/release/ubuntu-xx.xx-server-cloudimg-amd64.ova",
385
+ * ovfNetworkMap: ovfRemote.then(ovfRemote => ovfRemote.ovfNetworkMap),
386
+ * },
387
+ * cdroms: [{
388
+ * clientDevice: true,
389
+ * }],
390
+ * vapp: {
391
+ * properties: {
392
+ * hostname: remoteOvfName,
393
+ * "instance-id": remoteOvfUuid,
394
+ * "public-keys": remoteOvfPublicKeys,
395
+ * password: remoteOvfPassword,
396
+ * "user-data": std.index.base64encode({
397
+ * input: remoteOvfUserData,
398
+ * }).result,
399
+ * },
400
+ * },
401
+ * });
402
+ * //# Deployment of VM from Local OVF
403
+ * const vmFromLocalOvf = new vsphere.VirtualMachine("vmFromLocalOvf", {
404
+ * networkInterfaces: .map(entry => ({
405
+ * networkId: entry.value,
406
+ * })),
407
+ * name: "ubuntu-server-cloud-image-02",
408
+ * datacenterId: datacenter.then(datacenter => datacenter.id),
409
+ * datastoreId: datastore.then(datastore => datastore.id),
410
+ * resourcePoolId: _default.then(_default => _default.id),
411
+ * numCpus: ovfLocal.then(ovfLocal => ovfLocal.numCpus),
412
+ * numCoresPerSocket: ovfLocal.then(ovfLocal => ovfLocal.numCoresPerSocket),
413
+ * memory: ovfLocal.then(ovfLocal => ovfLocal.memory),
414
+ * guestId: ovfLocal.then(ovfLocal => ovfLocal.guestId),
415
+ * firmware: ovfLocal.then(ovfLocal => ovfLocal.firmware),
416
+ * scsiType: ovfLocal.then(ovfLocal => ovfLocal.scsiType),
417
+ * waitForGuestNetTimeout: 0,
418
+ * waitForGuestIpTimeout: 0,
419
+ * ovfDeploy: {
420
+ * allowUnverifiedSslCert: false,
421
+ * localOvfPath: ovfLocal.then(ovfLocal => ovfLocal.localOvfPath),
422
+ * diskProvisioning: ovfLocal.then(ovfLocal => ovfLocal.diskProvisioning),
423
+ * ovfNetworkMap: ovfLocal.then(ovfLocal => ovfLocal.ovfNetworkMap),
424
+ * },
425
+ * cdroms: [{
426
+ * clientDevice: true,
427
+ * }],
428
+ * vapp: {
429
+ * properties: {
430
+ * hostname: localOvfName,
431
+ * "instance-id": localOvfUuid,
432
+ * "public-keys": localOvfPublicKeys,
433
+ * password: localOvfPassword,
434
+ * "user-data": std.index.base64encode({
435
+ * input: localOvfUserData,
436
+ * }).result,
437
+ * },
438
+ * },
439
+ * });
440
+ * ```
441
+ *
442
+ * ### Cloning from an OVF/OVA with vApp Properties
443
+ *
444
+ * This alternate example illustrates how to clone a virtual machine from a template that originated from an OVF/OVA. This leverages the resource's vApp properties capabilities to set appropriate keys that control various configuration settings on the virtual machine or virtual appliance. In this scenario, using `customize` is not recommended as the functionality tends to overlap.
445
+ *
446
+ * **Example**:
447
+ *
448
+ * ```typescript
449
+ * import * as pulumi from "@pulumi/pulumi";
450
+ * import * as std from "@pulumi/std";
451
+ * import * as vsphere from "@pulumi/vsphere";
452
+ *
453
+ * const datacenter = vsphere.getDatacenter({
454
+ * name: "dc-01",
455
+ * });
456
+ * const datastore = datacenter.then(datacenter => vsphere.getDatastore({
457
+ * name: "datastore-01",
458
+ * datacenterId: datacenter.id,
459
+ * }));
460
+ * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({
461
+ * name: "cluster-01",
462
+ * datacenterId: datacenter.id,
463
+ * }));
464
+ * const _default = Promise.all([cluster, datacenter]).then(([cluster, datacenter]) => vsphere.getResourcePool({
465
+ * name: std.index.format({
466
+ * input: "%s%s",
467
+ * args: [
468
+ * cluster.name,
469
+ * "/Resources",
470
+ * ],
471
+ * }).result,
472
+ * datacenterId: datacenter.id,
473
+ * }));
474
+ * const host = datacenter.then(datacenter => vsphere.getHost({
475
+ * name: "esxi-01.example.com",
476
+ * datacenterId: datacenter.id,
477
+ * }));
478
+ * const network = datacenter.then(datacenter => vsphere.getNetwork({
479
+ * name: "172.16.11.0",
480
+ * datacenterId: datacenter.id,
481
+ * }));
482
+ * const templateFromOvf = datacenter.then(datacenter => vsphere.getVirtualMachine({
483
+ * name: "ubuntu-server-template-from-ova",
484
+ * datacenterId: datacenter.id,
485
+ * }));
486
+ * const vm = new vsphere.VirtualMachine("vm", {
487
+ * name: "foo",
488
+ * resourcePoolId: cluster.then(cluster => cluster.resourcePoolId),
489
+ * datastoreId: datastore.then(datastore => datastore.id),
490
+ * numCpus: 2,
491
+ * memory: 1024,
492
+ * guestId: template.guestId,
493
+ * scsiType: template.scsiType,
494
+ * networkInterfaces: [{
495
+ * networkId: network.then(network => network.id),
496
+ * adapterType: template.networkInterfaceTypes[0],
497
+ * }],
498
+ * disks: [{
499
+ * name: "Hard Disk 1",
500
+ * size: templateFromOvf.then(templateFromOvf => templateFromOvf.disks?.[0]?.size),
501
+ * thinProvisioned: templateFromOvf.then(templateFromOvf => templateFromOvf.disks?.[0]?.thinProvisioned),
502
+ * }],
503
+ * clone: {
504
+ * templateUuid: templateFromOvf.then(templateFromOvf => templateFromOvf.id),
505
+ * },
506
+ * vapp: {
507
+ * properties: {
508
+ * "guestinfo.hostname": "foo.example.com",
509
+ * "guestinfo.ipaddress": "172.16.11.101",
510
+ * "guestinfo.netmask": "255.255.255.0",
511
+ * "guestinfo.gateway": "172.16.11.1",
512
+ * "guestinfo.dns": "172.16.11.4",
513
+ * "guestinfo.domain": "example.com",
514
+ * "guestinfo.ntp": "ntp.example.com",
515
+ * "guestinfo.password": "VMware1!",
516
+ * "guestinfo.ssh": "True",
517
+ * },
518
+ * },
519
+ * });
520
+ * ```
521
+ *
522
+ * ### Using vSphere Storage DRS
523
+ *
524
+ * The `vsphere.VirtualMachine` resource also supports vSphere Storage DRS, allowing the assignment of virtual machines to datastore clusters. When assigned to a datastore cluster, changes to a virtual machine's underlying datastores are ignored unless disks drift outside of the datastore cluster. Note that the [`vsphere.DatastoreCluster`][tf-vsphere-datastore-cluster-resource] resource also exists to allow for management of datastore clusters using the Terraform provider.
525
+ *
526
+ * The following example demonstrates the use of the [`vsphere.DatastoreCluster`] data source[tf-vsphere-datastore-cluster-data-source], and the `datastoreClusterId` configuration setting.
527
+ *
528
+ * [tf-vsphere-datastore-cluster-resource]: /docs/providers/vsphere/r/datastore_cluster.html
529
+ * [tf-vsphere-datastore-cluster-data-source]: /docs/providers/vsphere/d/datastore_cluster.html
530
+ *
531
+ * > **NOTE:** When managing datastore clusters, member datastores, and virtual machines within the same Terraform configuration, race conditions can apply. This is because datastore clusters must be created before datastores can be assigned to them, and the respective `vsphere.VirtualMachine` resources will no longer have an implicit dependency on the specific datastore resources. Use [`dependsOn`][tf-docs-depends-on] to create an explicit dependency on the datastores in the cluster, or manage datastore clusters and datastores in a separate configuration.
532
+ *
533
+ * [tf-docs-depends-on]: /docs/configuration/resources.html#depends_on
534
+ *
535
+ * **Example**:
536
+ *
537
+ * ```typescript
538
+ * import * as pulumi from "@pulumi/pulumi";
539
+ * import * as vsphere from "@pulumi/vsphere";
540
+ *
541
+ * const datacenter = vsphere.getDatacenter({
542
+ * name: "dc-01",
543
+ * });
544
+ * const datastoreCluster = datacenter.then(datacenter => vsphere.getDatastoreCluster({
545
+ * name: "datastore-cluster-01",
546
+ * datacenterId: datacenter.id,
547
+ * }));
548
+ * const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({
549
+ * name: "cluster-01",
550
+ * datacenterId: datacenter.id,
551
+ * }));
552
+ * const network = datacenter.then(datacenter => vsphere.getNetwork({
553
+ * name: "VM Network",
554
+ * datacenterId: datacenter.id,
555
+ * }));
556
+ * const vm = new vsphere.VirtualMachine("vm", {
557
+ * name: "foo",
558
+ * resourcePoolId: cluster.then(cluster => cluster.resourcePoolId),
559
+ * datastoreClusterId: datastoreCluster.then(datastoreCluster => datastoreCluster.id),
560
+ * numCpus: 1,
561
+ * memory: 1024,
562
+ * guestId: "otherLinux64Guest",
563
+ * networkInterfaces: [{
564
+ * networkId: network.then(network => network.id),
565
+ * }],
566
+ * disks: [{
567
+ * label: "Hard Disk 1",
568
+ * size: 20,
569
+ * }],
570
+ * });
571
+ * ```
572
+ *
573
+ * ## Creating a Virtual Machine from a Template
574
+ *
575
+ * The `clone` block can be used to create a new virtual machine from an existing virtual machine or template. The resource supports both making a complete copy of a virtual machine, or cloning from a snapshot (also known as a linked clone).
576
+ *
577
+ * See the section on cloning and customization for more information.
578
+ *
579
+ * > **NOTE:** Changing any option in `clone` after creation forces a new resource.
580
+ *
581
+ * > **NOTE:** Cloning requires vCenter Server and is not supported on direct ESXi host connections.
582
+ *
583
+ * The options available in the `clone` block are:
584
+ *
585
+ * * `templateUuid` - (Required) The UUID of the source virtual machine or template.
586
+ *
587
+ * * `linkedClone` - (Optional) Clone the virtual machine from a snapshot or a template. Default: `false`.
588
+ *
589
+ * * `timeout` - (Optional) The timeout, in minutes, to wait for the cloning process to complete. Default: 30 minutes.
590
+ *
591
+ * * `customize` - (Optional) The customization spec for this clone. This allows the user to configure the virtual machine post-clone. For more details, see virtual machine customizations.
592
+ *
593
+ * ### Virtual Machine Customizations
594
+ *
595
+ * As part of the `clone` operation, a virtual machine can be [customized][vmware-docs-customize] to configure host, network, or licensing settings.
596
+ *
597
+ * [vmware-docs-customize]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-virtual-machine-administration-guide-8-0/managing-virtual-machinesvsphere-vm-admin/customizing-guest-operating-systemsvsphere-vm-admin.html
598
+ *
599
+ * To perform virtual machine customization as a part of the clone process,
600
+ * specify the `customize` block with the respective customization options, nested within the `clone` block. Windows guests are customized using Sysprep, which will result in the machine SID being reset. Before using customization, check is that your source virtual machine meets the [requirements](https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-virtual-machine-administration-guide-8-0/managing-virtual-machinesvsphere-vm-admin/customizing-guest-operating-systemsvsphere-vm-admin.html) for guest OS customization on vSphere. See the section on cloning and customization for a usage synopsis.
601
+ *
602
+ * The settings for `customize` are as follows:
603
+ *
604
+ * #### Customization Timeout Settings
605
+ *
606
+ * * `timeout` - (Optional) The time, in minutes, that the provider waits for customization to complete before failing. The default is `10` minutes. Setting the value to `0` or a negative value disables the waiter.
607
+ *
608
+ * #### Network Interface Settings
609
+ *
610
+ * These settings, which should be specified in nested `networkInterface` blocks within `customize` block, configure network interfaces on a per-interface basis and are matched up to `networkInterface` devices in the order declared.
611
+ *
612
+ * Static IP Address Example:
613
+ *
614
+ * ```typescript
615
+ * import * as pulumi from "@pulumi/pulumi";
616
+ * import * as vsphere from "@pulumi/vsphere";
617
+ *
618
+ * const vm = new vsphere.VirtualMachine("vm", {
619
+ * networkInterfaces: [
620
+ * {
621
+ * networkId: _public.id,
622
+ * },
623
+ * {
624
+ * networkId: _private.id,
625
+ * },
626
+ * ],
627
+ * clone: {
628
+ * customize: {
629
+ * networkInterfaces: [
630
+ * {
631
+ * ipv4Address: "10.0.0.10",
632
+ * ipv4Netmask: 24,
633
+ * },
634
+ * {
635
+ * ipv4Address: "172.16.0.10",
636
+ * ipv4Netmask: 24,
637
+ * },
638
+ * ],
639
+ * ipv4Gateway: "10.0.0.1",
640
+ * },
641
+ * },
642
+ * });
643
+ * ```
644
+ *
645
+ * The first `networkInterface` would be assigned to the `public` interface, and the second to the `private` interface.
646
+ *
647
+ * To use DHCP, declare an empty `networkInterface` block for each interface.
648
+ *
649
+ * **Example**:
650
+ *
651
+ * ```typescript
652
+ * import * as pulumi from "@pulumi/pulumi";
653
+ * import * as vsphere from "@pulumi/vsphere";
654
+ *
655
+ * const vm = new vsphere.VirtualMachine("vm", {
656
+ * networkInterfaces: [
657
+ * {
658
+ * networkId: _public.id,
659
+ * },
660
+ * {
661
+ * networkId: _private.id,
662
+ * },
663
+ * ],
664
+ * clone: {
665
+ * customize: {
666
+ * networkInterfaces: [
667
+ * {},
668
+ * {},
669
+ * ],
670
+ * },
671
+ * },
672
+ * });
673
+ * ```
674
+ *
675
+ * The options are:
676
+ *
677
+ * * `dnsServerList` - (Optional) DNS servers for the network interface. Used by Windows guest operating systems, but ignored by Linux distribution guest operating systems. For Linux, please refer to the section on the global DNS settings.
678
+ *
679
+ * * `dnsDomain` - (Optional) DNS search domain for the network interface. Used by Windows guest operating systems, but ignored by Linux distribution guest operating systems. For Linux, please refer to the section on the global DNS settings.
680
+ *
681
+ * * `ipv4Address` - (Optional) The IPv4 address assigned to the network adapter. If blank or not included, DHCP is used.
682
+ *
683
+ * * `ipv4Netmask` The IPv4 subnet mask, in bits (_e.g._ `24` for 255.255.255.0).
684
+ *
685
+ * * `ipv6Address` - (Optional) The IPv6 address assigned to the network adapter. If blank or not included, auto-configuration is used.
686
+ *
687
+ * * `ipv6Netmask` - (Optional) The IPv6 subnet mask, in bits (_e.g._ `32`).
688
+ *
689
+ * > **NOTE:** The minimum setting for IPv4 in a customization specification is DHCP. If you are setting up an IPv6-exclusive network without DHCP, you may need to set `waitForGuestNetTimeout` to a high enough value to cover the DHCP timeout of your virtual machine, or disable by supplying a zero or negative value. Disabling `waitForGuestNetTimeout` may result in IP addresses not being reported to any provisioners you may have configured on the resource.
690
+ *
691
+ * #### Global Routing Settings
692
+ *
693
+ * Virtual machine customization for the `vsphere.VirtualMachine` resource does not take a per-interface gateway setting. Default routes are configured on a global basis. See the section on network interface settings for more information.
694
+ *
695
+ * The settings must match the IP address and netmask of at least one `networkInterface` supplied to customization.
696
+ *
697
+ * The options are:
698
+ *
699
+ * * `ipv4Gateway` - (Optional) The IPv4 default gateway when using `networkInterface` customization on the virtual machine.
700
+ *
701
+ * * `ipv6Gateway` - (Optional) The IPv6 default gateway when using `networkInterface` customization on the virtual machine.
702
+ *
703
+ * #### Global DNS Settings
704
+ *
705
+ * The following settings configure DNS globally, generally for Linux distribution guest operating systems. For Windows guest operating systems, this is performer per-interface. See the section on network interface settings for more information.
706
+ *
707
+ * * `dnsServerList` - The list of DNS servers to configure on the virtual machine.
708
+ *
709
+ * * `dnsSuffixList` - A list of DNS search domains to add to the DNS configuration on the virtual machine.
710
+ *
711
+ * #### Linux Customization Options
712
+ *
713
+ * The settings in the `linuxOptions` block pertain to Linux distribution guest operating system customization. If you are customizing a Linux guest operating system, this section must be included.
714
+ *
715
+ * **Example**:
716
+ *
717
+ * ```typescript
718
+ * import * as pulumi from "@pulumi/pulumi";
719
+ * import * as vsphere from "@pulumi/vsphere";
720
+ *
721
+ * const vm = new vsphere.VirtualMachine("vm", {clone: {
722
+ * customize: {
723
+ * linuxOptions: {
724
+ * hostName: "foo",
725
+ * domain: "example.com",
726
+ * },
727
+ * },
728
+ * }});
729
+ * ```
730
+ *
731
+ * The options are:
732
+ *
733
+ * * `hostName` - (Required) The host name for this machine. This, along with `domain`, make up the FQDN of the virtual machine.
734
+ *
735
+ * * `domain` - (Required) The domain name for this machine. This, along with `hostName`, make up the FQDN of the virtual machine.
736
+ *
737
+ * * `hwClockUtc` - (Optional) Tells the operating system that the hardware clock is set to UTC. Default: `true`.
738
+ *
739
+ * * `scriptText` - (Optional) The customization script for the virtual machine that will be applied before and / or after guest customization. For more information on enabling and using a customization script, please refer to [VMware KB 74880][kb-74880]. The [Heredoc style][tf-heredoc-strings] of string literal is recommended.
740
+ *
741
+ * [kb-74880]: https://knowledge.broadcom.com/external/article?articleNumber=313048
742
+ * [tf-heredoc-strings]: https://www.terraform.io/language/expressions/strings#heredoc-strings
743
+ *
744
+ * * `timeZone` - (Optional) Sets the time zone. For a list of possible combinations, please refer to [VMware KB 2145518][kb-2145518]. The default is UTC.
745
+ *
746
+ * [kb-2145518]: https://knowledge.broadcom.com/external/article?articleNumber=320212
747
+ *
748
+ * #### Windows Customization Options
749
+ *
750
+ * The settings in the `windowsOptions` block pertain to Windows guest OS customization. If you are customizing a Windows operating system, this section must be included.
751
+ *
752
+ * **Example**:
753
+ *
754
+ * ```typescript
755
+ * import * as pulumi from "@pulumi/pulumi";
756
+ * import * as vsphere from "@pulumi/vsphere";
757
+ *
758
+ * const vm = new vsphere.VirtualMachine("vm", {clone: {
759
+ * customize: {
760
+ * windowsOptions: {
761
+ * computerName: "foo",
762
+ * workgroup: "BAR",
763
+ * adminPassword: "VMware1!",
764
+ * },
765
+ * },
766
+ * }});
767
+ * ```
768
+ *
769
+ * The options are:
770
+ *
771
+ * * `computerName` - (Required) The computer name of the virtual machine.
772
+ *
773
+ * * `adminPassword` - (Optional) The administrator password for the virtual machine.
774
+ *
775
+ * > **NOTE:** `adminPassword` is a sensitive field and will not be output on-screen, but is stored in state and sent to the virtual machine in plain text.
776
+ *
777
+ * * `workgroup` - (Optional) The workgroup name for the virtual machine. One of this or `joinDomain` must be included.
778
+ *
779
+ * * `joinDomain` - (Optional) The domain name in which to join the virtual machine. One of this or `workgroup` must be included.
780
+ *
781
+ * * `domainOu` - (Optional) The `MachineObjectOU` which specifies the full LDAP path name of the OU to which the virtual machine belongs (_e.g._, OU=bar,OU=foo,DC=example,DC=com").
782
+ *
783
+ * > **NOTE:** `domainOu` is only available on vSphere 8.0 Update 2 and later.
784
+ *
785
+ * > **NOTE:** `domainOu` must **not** contain a spaces in the `MachineObjectOU` path (_e.g._, OU=foo bar,DC=example,DC=com").
786
+ *
787
+ * **Example**:
788
+ *
789
+ * ```typescript
790
+ * import * as pulumi from "@pulumi/pulumi";
791
+ * import * as vsphere from "@pulumi/vsphere";
792
+ *
793
+ * const vm = new vsphere.VirtualMachine("vm", {clone: {
794
+ * customize: {
795
+ * windowsOptions: {
796
+ * domainOu: "OU=bar,OU=foo,DC=example,DC=com",
797
+ * },
798
+ * },
799
+ * }});
800
+ * ```
801
+ *
802
+ * * `domainAdminUser` - (Optional) The user account with administrative privileges to use to join the guest operating system to the domain. Required if setting `joinDomain`.
803
+ *
804
+ * * `domainAdminPassword` - (Optional) The password user account with administrative privileges used to join the virtual machine to the domain. Required if setting `joinDomain`.
805
+ *
806
+ * > **NOTE:** `domainAdminPassword` is a sensitive field and will not be output on-screen, but is stored in state and sent to the virtual machine in plain text
807
+ *
808
+ * * `fullName` - (Optional) The full name of the organization owner of the virtual machine. This populates the "user" field in the general Windows system information. Default: `Administrator`.
809
+ *
810
+ * * `organizationName` - (Optional) The name of the organization for the virtual machine. This option populates the "organization" field in the general Windows system information. Default: `Managed by Terraform`.
811
+ *
812
+ * * `productKey` - (Optional) The product key for the virtual machine Windows guest operating system. The default is no key.
813
+ *
814
+ * * `runOnceCommandList` - (Optional) A list of commands to run at first user logon, after guest customization. Each run once command is limited by the API to 260 characters.
815
+ *
816
+ * * `autoLogon` - (Optional) Specifies whether or not the virtual machine automatically logs on as Administrator. Default: `false`.
817
+ *
818
+ * * `autoLogonCount` - (Optional) Specifies how many times the virtual machine should auto-logon the Administrator account when `autoLogon` is `true`. This option should be set accordingly to ensure that all of your commands that run in `runOnceCommandList` can log in to run. Default: `1`.
819
+ *
820
+ * * `timeZone` - (Optional) The time zone for the virtual machine. For a list of supported codes, please refer to the [MIcrosoft documentation][ms-docs-valid-sysprep-tzs]. The default is `85` (GMT/UTC).
821
+ *
822
+ * [ms-docs-valid-sysprep-tzs]: https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx
823
+ *
824
+ * ### Using vApp Properties for OVF/OVA Configuration
825
+ *
826
+ * You can use the `properties` section of the `vapp` block to supply configuration parameters to a virtual machine cloned from a template that originated from an imported OVF/OVA file. Both GuestInfo and ISO transport methods are supported.
827
+ *
828
+ * For templates that use ISO transport, a CD-ROM backed by a client device must be included.
829
+ *
830
+ * **Example**:
831
+ *
832
+ * ```typescript
833
+ * import * as pulumi from "@pulumi/pulumi";
834
+ * import * as vsphere from "@pulumi/vsphere";
835
+ *
836
+ * const vm = new vsphere.VirtualMachine("vm", {
837
+ * clone: {
838
+ * templateUuid: templateFromOvf.id,
839
+ * },
840
+ * cdroms: [{
841
+ * clientDevice: true,
842
+ * }],
843
+ * vapp: {
844
+ * properties: {
845
+ * [terraform.id]: "foo",
846
+ * },
847
+ * },
848
+ * });
849
+ * ```
850
+ *
851
+ * See the section on CD-ROM options for more information.
852
+ *
853
+ * > **NOTE:** The only supported usage path for vApp properties is for existing user-configurable keys. These generally come from an existing template created by importing an OVF or OVA file. You cannot set values for vApp properties on virtual machines created from scratch, virtual machines lacking a vApp configuration, or on property keys that do not exist.
854
+ *
855
+ * **Example**:
856
+ *
857
+ * ```typescript
858
+ * import * as pulumi from "@pulumi/pulumi";
859
+ * import * as vsphere from "@pulumi/vsphere";
860
+ *
861
+ * const vm = new vsphere.VirtualMachine("vm", {
862
+ * clone: {
863
+ * templateUuid: templateFromOvf.id,
864
+ * },
865
+ * vapp: {
866
+ * properties: {
867
+ * [terraform.id]: "foo",
868
+ * },
869
+ * },
870
+ * });
871
+ * ```
872
+ *
873
+ * The vApp Properties for some OVF/OVA may require boolean values.
874
+ *
875
+ * In Terraform a boolean is defined as `bool` with a value of either `true` or `false`.
876
+ *
877
+ * **Example**: A boolean variable type for the Terraform provider configuration.
878
+ *
879
+ * ```typescript
880
+ * import * as pulumi from "@pulumi/pulumi";
881
+ *
882
+ * const config = new pulumi.Config();
883
+ * // Allow insecure connections. Set to `true` for self-signed certificates.
884
+ * const vsphereInsecure = config.getBoolean("vsphereInsecure") || false;
885
+ * ```
886
+ *
887
+ * However, for OVF properties, even though the type is boolean, the vApp Options in vSphere only accepts the values of `"True"` or `"False"`.
888
+ *
889
+ * In these instances, it is recommended to define the variable as a string and pass the value in title case.
890
+ *
891
+ * **Example**: A string variable for to pass to an OVF/OVA boolean OVF property.
892
+ *
893
+ * ```typescript
894
+ * import * as pulumi from "@pulumi/pulumi";
895
+ * import * as vsphere from "@pulumi/vsphere";
896
+ *
897
+ * const config = new pulumi.Config();
898
+ * // Enable SSH on the virtual appliance. One of `True` or `False`.
899
+ * const sshEnabled = config.get("sshEnabled") || "False";
900
+ * const vm = new vsphere.VirtualMachine("vm", {vapp: {
901
+ * properties: {
902
+ * ssh_enabled: sshEnabled,
903
+ * },
904
+ * }});
905
+ * ```
906
+ *
907
+ * ### Additional Requirements for Cloning
908
+ *
909
+ * When cloning from a template, there are additional requirements in both the resource configuration and source template:
910
+ *
911
+ * * The virtual machine must not be powered on at the time of cloning.
912
+ * * All disks on the virtual machine must be SCSI disks.
913
+ * * You must specify at least the same number of `disk` devices as there are disks that exist in the template. These devices are ordered and lined up by the `unitNumber` attribute. Additional disks can be added past this.
914
+ * * The `size` of a virtual disk must be at least the same size as its counterpart disk in the source template.
915
+ * * When using `linkedClone`, the `size`, `thinProvisioned`, and `eagerlyScrub` settings for each disk must be an exact match to the individual disk's counterpart in the source template.
916
+ * * The storage controller count settings should be configured as necessary to cover all of the disks on the template. For best results, only configure this setting for the number of controllers you will need to cover your disk quantity and bandwidth needs, and configure your template accordingly. For most workloads, this setting should be kept at the default of `1` SCSI controller, and all disks in the template should reside on the single, primary controller.
917
+ * * Some operating systems do not respond well to a change in disk controller type. Ensure that `scsiType` is set to an exact match of the template's controller set. For maximum compatibility, make sure the SCSI controllers on the source template are all the same type.
918
+ *
919
+ * You can use the [`vsphere.VirtualMachine`][tf-vsphere-virtual-machine-ds] data source, which provides disk attributes, network interface types, SCSI bus types, and the guest ID of the source template, to return this information. See the section on cloning and customization for more information.
920
+ *
921
+ * ## Trusted Platform Module
922
+ *
923
+ * When creating a virtual machine or cloning one from a template, you have the option to add a virtual Trusted Platform Module device. Refer to the requirements in the VMware vSphere [product documentation](https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-virtual-machine-administration-guide-8-0/configuring-virtual-machine-hardwarevsphere-vm-admin/securing-virtual-machines-with-virtual-trusted-platform-modulevsphere-vm-admin/vtpm-overviewvsphere-vm-admin.html).
924
+ *
925
+ * **Example**:
926
+ *
927
+ * ```typescript
928
+ * import * as pulumi from "@pulumi/pulumi";
929
+ * import * as vsphere from "@pulumi/vsphere";
930
+ *
931
+ * const vm = new vsphere.VirtualMachine("vm", {vtpm: {
932
+ * version: "2.0",
933
+ * }});
934
+ * ```
935
+ *
936
+ * > **NOTE:** Supported versions include 1.2 or 2.0.
937
+ *
938
+ * ## Virtual Machine Migration
939
+ *
940
+ * The `vsphere.VirtualMachine` resource supports live migration both on the host and storage level. You can migrate the virtual machine to another host, cluster, resource pool, or datastore. You can also migrate or pin a virtual disk to a specific datastore.
941
+ *
942
+ * ### Host, Cluster, and Resource Pool Migration
943
+ *
944
+ * To migrate the virtual machine to another host or resource pool, change the `hostSystemId` or `resourcePoolId` to the managed object IDs of the new host or resource pool. To change the virtual machine's cluster or standalone host, select a resource pool within the specific target.
945
+ *
946
+ * The same rules apply for migration as they do for virtual machine creation - any host specified must contribute the resource pool supplied. When moving a virtual machine to a resource pool in another cluster (or standalone host), ensure that all hosts in the cluster (or the single standalone host) have access to the datastore on which the virtual machine is placed.
947
+ *
948
+ * ### Storage Migration
949
+ *
950
+ * Storage migration can be done on two levels:
951
+ *
952
+ * * Global datastore migration can be handled by changing the global `datastoreId` attribute. This triggers a storage migration for all disks that do not have an explicit `datastoreId` specified.
953
+ * * When using Storage DRS through the `datastoreClusterId` attribute, the entire virtual machine can be migrated from one datastore cluster to another by changing the value of this setting. In addition, when `datastoreClusterId` is in use, any disks that drift to datastores outside of the datastore cluster via such actions as manual modification will be migrated back to the datastore cluster on the next apply.
954
+ * * An individual `disk` device can be migrated by manually specifying the `datastoreId` in its configuration block. This also pins it to the specific datastore that is specified - if at a later time the virtual machine and any unpinned disks migrate to another host, the disk will stay on the specified datastore.
955
+ *
956
+ * An example of datastore pinning is below. As long as the datastore in the `pinnedDatastore` data source does not change, any change to the standard `vmDatastore` data source will not affect the data disk - the disk will stay where it is.
957
+ *
958
+ * **Example**:
959
+ *
960
+ * ```typescript
961
+ * import * as pulumi from "@pulumi/pulumi";
962
+ * import * as vsphere from "@pulumi/vsphere";
963
+ *
964
+ * const vm = new vsphere.VirtualMachine("vm", {
965
+ * datastoreId: vmDatastore.id,
966
+ * disks: [
967
+ * {
968
+ * label: "Hard Disk 1",
969
+ * size: 10,
970
+ * },
971
+ * {
972
+ * datastoreId: pinnedDatastore.id,
973
+ * label: "Hard Disk 2",
974
+ * size: 100,
975
+ * unitNumber: 1,
976
+ * },
977
+ * ],
978
+ * });
979
+ * ```
980
+ *
981
+ * #### Storage Migration Restrictions
982
+ *
983
+ * You cannot migrate external disks added with the `attach` parameter. Typically, these disks are created and assigned to a datastore outside the scope of the `vsphere.VirtualMachine` resource. For example, using the [`vsphere.VirtualDisk`][tf-vsphere-virtual-disk] resource, management of the disks would render their configuration unstable.
984
+ *
985
+ * [tf-vsphere-virtual-disk]: /docs/providers/vsphere/r/virtual_disk.html
986
+ *
987
+ * ## Virtual Machine Reboot
988
+ *
989
+ * The virtual machine will be rebooted if any of the following parameters are changed:
990
+ *
991
+ * * `alternateGuestName`
992
+ * * `cpuHotAddEnabled`
993
+ * * `cpuHotRemoveEnabled`
994
+ * * `cpuPerformanceCountersEnabled`
995
+ * * `disk.controller_type`
996
+ * * `disk.unit_number`
997
+ * * `disk.disk_mode`
998
+ * * `disk.write_through`
999
+ * * `disk.disk_sharing`
1000
+ * * `efiSecureBootEnabled`
1001
+ * * `eptRviMode`
1002
+ * * `enableDiskUuid`
1003
+ * * `enableLogging`
1004
+ * * `extraConfig`
1005
+ * * `firmware`
1006
+ * * `guestId`
1007
+ * * `hardwareVersion`
1008
+ * * `hvMode`
1009
+ * * `memory` - When reducing the memory size, or when increasing the memory size and `memoryHotAddEnabled` is set to `false`
1010
+ * * `memoryHotAddEnabled`
1011
+ * * `nestedHvEnabled`
1012
+ * * `networkInterface` - When deleting a network interface and VMware Tools is not running.
1013
+ * * `network_interface.adapter_type` - When VMware Tools is not running.
1014
+ * * `numCoresPerSocket`
1015
+ * * `pciDeviceId`
1016
+ * * `runToolsScriptsAfterPowerOn`
1017
+ * * `runToolsScriptsAfterResume`
1018
+ * * `runToolsScriptsBeforeGuestStandby`
1019
+ * * `runToolsScriptsBeforeGuestShutdown`
1020
+ * * `runToolsScriptsBeforeGuestReboot`
1021
+ * * `swapPlacementPolicy`
1022
+ * * `toolsUpgradePolicy`
1023
+ * * `vbsEnabled`
1024
+ * * `vvtdEnabled`
1025
+ * * `vtpm`
1026
+ *
1027
+ * ## Migrating from a Previous Version of the Resource
1028
+ *
1029
+ * > **NOTE:** This section only applies this resource available in v0.4.2 or earlier of this provider.
1030
+ *
1031
+ * The path for migrating to the current version of this resource is very similar to the import path; however, with the exception that the `pulumi import` command does not need to be run. See that section for details on what is required before you run `pulumi preview` on a provider resource that must be migrated.
1032
+ *
1033
+ * A successful migration usually only results in a configuration-only diff - that is, Terraform reconciles the configuration settings that can not be set during the migration process with he Terraform state. In this event, no reconfiguration operations are sent to vSphere during the next `pulumi up`. For more information, see the importing section.
1034
+ *
9
1035
  * ## Import
10
1036
  *
1037
+ * An existing virtual machine can be imported into the Terraform state by providing the full path to the virtual machine.
1038
+ *
1039
+ * [docs-import]: /docs/import/index.html
1040
+ *
1041
+ * **Examples**:
1042
+ *
1043
+ * Import a virtual machine resource named `foo` located in the `dc-01` datacenter.
1044
+ *
1045
+ * ```sh
1046
+ * $ pulumi import vsphere:index/virtualMachine:VirtualMachine vm /dc-01/vm/foo
1047
+ * ```
1048
+ *
1049
+ * > **NOTE:** The `vm` portion of the path is required by vSphere. If the virtual machine is located in a folder, the folder path needs to be included. This is because vSphere organizes virtual machines within a datacenter under the `vm` folder, and any additional folders created within the `vm` folder must be included in the path.
1050
+ *
1051
+ * If the virtual machine `foo` is in a folder named `bar`, the import command would be:
1052
+ *
1053
+ * ```sh
1054
+ * $ pulumi import vsphere:index/virtualMachine:VirtualMachine vm /dc-01/vm/bar/foo
1055
+ * ```
1056
+ *
11
1057
  * ### Additional Importing Requirements
12
1058
  *
13
- * Many of the requirements for [cloning](#additional-requirements-and-notes-for-cloning) apply to importing. Although importing writes directly to the Terraform state, some rules can not be enforced during import time, so every effort should be made to ensure the correctness of the configuration before the import.
1059
+ * Many of the requirements for cloning apply to importing. Although importing writes directly to the Terraform state, some rules can not be enforced during import time, so every effort should be made to ensure the correctness of the configuration before the import.
14
1060
  *
15
1061
  * The following requirements apply to import:
16
1062
  *
17
- * * 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`.
1063
+ * * The disks must have a `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`.
1064
+ *
1065
+ * > **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_`.
18
1066
  *
19
- * * Disks are always imported with [`keep_on_remove`](#keep_on_remove) enabled until the first `pulumi up` run which will remove the setting for known disks. This process safeguards against naming or accounting mistakes in the disk configuration.
1067
+ * * Disks are always imported with `keepOnRemove` enabled until the first `pulumi up` run which will remove the setting for known disks. This process safeguards against naming or accounting mistakes in the disk configuration.
20
1068
  *
21
1069
  * * The storage controller count for the resource is set to the number of contiguous storage controllers found, starting with the controller at SCSI bus number `0`. If no storage controllers are discovered, the virtual machine is not eligible for import. For maximum compatibility, ensure that the virtual machine has the exact number of storage controllers needed and set the storage controller count accordingly.
22
1070
  *
23
1071
  * After importing, you should run `pulumi preview`. Unless you have changed anything else in the configuration that would cause other attributes to change. The only difference should be configuration-only changes, which are typically comprised of:
24
1072
  *
25
- * * The [`imported`](#imported) flag will transition from `true` to `false`.
1073
+ * * The `imported` flag will transition from `true` to `false`.
1074
+ *
1075
+ * * The `keepOnRemove` of known disks will transition from `true` to `false`.
26
1076
  *
27
- * * The [`keep_on_remove`](#keep_on_remove) of known disks will transition from `true` to `false`.
1077
+ * * Configuration supplied in the `clone` block, if present, will be persisted to state. This initial persistence operation does not perform any cloning or customization actions, nor does it force a new resource. After the first apply operation, further changes to `clone` will force the creation of a new resource.
28
1078
  *
29
- * * Configuration supplied in the [`clone`](#clone) block, if present, will be persisted to state. This initial persistence operation does not perform any cloning or customization actions, nor does it force a new resource. After the first apply operation, further changes to `clone` will force the creation of a new resource.
1079
+ * > **NOTE:** Do not make any configuration changes to `clone` after importing or upgrading from a legacy version of the provider before doing an initial `pulumi up` as these changes will not correctly force a new resource and your changes will have persisted to state, preventing further plans from correctly triggering a diff.
30
1080
  *
31
1081
  * These changes only update Terraform state when applied. Hence, it is safe to run when the virtual machine is running. If more settings are modified, you may need to plan maintenance accordingly for any necessary virtual machine re-configurations.
32
1082
  */