pulumi-vsphere 4.10.0a1710245029__py3-none-any.whl → 4.13.0a1736849827__py3-none-any.whl

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 (85) hide show
  1. pulumi_vsphere/__init__.py +28 -0
  2. pulumi_vsphere/_inputs.py +1816 -277
  3. pulumi_vsphere/_utilities.py +41 -5
  4. pulumi_vsphere/compute_cluster.py +937 -1488
  5. pulumi_vsphere/compute_cluster_host_group.py +67 -2
  6. pulumi_vsphere/compute_cluster_vm_affinity_rule.py +69 -34
  7. pulumi_vsphere/compute_cluster_vm_anti_affinity_rule.py +41 -2
  8. pulumi_vsphere/compute_cluster_vm_dependency_rule.py +205 -2
  9. pulumi_vsphere/compute_cluster_vm_group.py +198 -2
  10. pulumi_vsphere/compute_cluster_vm_host_rule.py +73 -2
  11. pulumi_vsphere/config/__init__.pyi +5 -0
  12. pulumi_vsphere/config/vars.py +5 -0
  13. pulumi_vsphere/content_library.py +113 -12
  14. pulumi_vsphere/content_library_item.py +143 -2
  15. pulumi_vsphere/custom_attribute.py +77 -2
  16. pulumi_vsphere/datacenter.py +48 -40
  17. pulumi_vsphere/datastore_cluster.py +217 -366
  18. pulumi_vsphere/datastore_cluster_vm_anti_affinity_rule.py +159 -2
  19. pulumi_vsphere/distributed_port_group.py +416 -189
  20. pulumi_vsphere/distributed_virtual_switch.py +571 -830
  21. pulumi_vsphere/dpm_host_override.py +63 -2
  22. pulumi_vsphere/drs_vm_override.py +67 -2
  23. pulumi_vsphere/entity_permissions.py +64 -38
  24. pulumi_vsphere/file.py +21 -24
  25. pulumi_vsphere/folder.py +148 -30
  26. pulumi_vsphere/get_compute_cluster.py +16 -9
  27. pulumi_vsphere/get_compute_cluster_host_group.py +36 -25
  28. pulumi_vsphere/get_content_library.py +23 -15
  29. pulumi_vsphere/get_content_library_item.py +29 -13
  30. pulumi_vsphere/get_custom_attribute.py +14 -9
  31. pulumi_vsphere/get_datacenter.py +30 -12
  32. pulumi_vsphere/get_datastore.py +29 -21
  33. pulumi_vsphere/get_datastore_cluster.py +31 -10
  34. pulumi_vsphere/get_datastore_stats.py +63 -57
  35. pulumi_vsphere/get_distributed_virtual_switch.py +18 -9
  36. pulumi_vsphere/get_dynamic.py +35 -25
  37. pulumi_vsphere/get_folder.py +23 -11
  38. pulumi_vsphere/get_guest_os_customization.py +26 -52
  39. pulumi_vsphere/get_host.py +16 -9
  40. pulumi_vsphere/get_host_base_images.py +104 -0
  41. pulumi_vsphere/get_host_pci_device.py +28 -19
  42. pulumi_vsphere/get_host_thumbprint.py +41 -25
  43. pulumi_vsphere/get_host_vgpu_profile.py +20 -15
  44. pulumi_vsphere/get_license.py +20 -10
  45. pulumi_vsphere/get_network.py +80 -24
  46. pulumi_vsphere/get_ovf_vm_template.py +56 -5
  47. pulumi_vsphere/get_policy.py +13 -9
  48. pulumi_vsphere/get_resource_pool.py +29 -23
  49. pulumi_vsphere/get_role.py +23 -13
  50. pulumi_vsphere/get_tag.py +16 -9
  51. pulumi_vsphere/get_tag_category.py +16 -9
  52. pulumi_vsphere/get_vapp_container.py +15 -9
  53. pulumi_vsphere/get_virtual_machine.py +205 -48
  54. pulumi_vsphere/get_vmfs_disks.py +18 -9
  55. pulumi_vsphere/guest_os_customization.py +60 -5
  56. pulumi_vsphere/ha_vm_override.py +352 -380
  57. pulumi_vsphere/host.py +244 -64
  58. pulumi_vsphere/host_port_group.py +27 -24
  59. pulumi_vsphere/host_virtual_switch.py +209 -289
  60. pulumi_vsphere/license.py +5 -32
  61. pulumi_vsphere/nas_datastore.py +74 -9
  62. pulumi_vsphere/offline_software_depot.py +185 -0
  63. pulumi_vsphere/outputs.py +717 -270
  64. pulumi_vsphere/provider.py +7 -6
  65. pulumi_vsphere/pulumi-plugin.json +2 -1
  66. pulumi_vsphere/resource_pool.py +168 -411
  67. pulumi_vsphere/role.py +33 -2
  68. pulumi_vsphere/storage_drs_vm_override.py +133 -2
  69. pulumi_vsphere/supervisor.py +967 -0
  70. pulumi_vsphere/tag.py +159 -2
  71. pulumi_vsphere/tag_category.py +83 -2
  72. pulumi_vsphere/vapp_container.py +163 -2
  73. pulumi_vsphere/vapp_entity.py +147 -2
  74. pulumi_vsphere/virtual_disk.py +123 -36
  75. pulumi_vsphere/virtual_machine.py +698 -829
  76. pulumi_vsphere/virtual_machine_class.py +447 -0
  77. pulumi_vsphere/virtual_machine_snapshot.py +13 -12
  78. pulumi_vsphere/vm_storage_policy.py +120 -127
  79. pulumi_vsphere/vmfs_datastore.py +271 -2
  80. pulumi_vsphere/vnic.py +104 -105
  81. {pulumi_vsphere-4.10.0a1710245029.dist-info → pulumi_vsphere-4.13.0a1736849827.dist-info}/METADATA +7 -6
  82. pulumi_vsphere-4.13.0a1736849827.dist-info/RECORD +86 -0
  83. {pulumi_vsphere-4.10.0a1710245029.dist-info → pulumi_vsphere-4.13.0a1736849827.dist-info}/WHEEL +1 -1
  84. pulumi_vsphere-4.10.0a1710245029.dist-info/RECORD +0 -82
  85. {pulumi_vsphere-4.10.0a1710245029.dist-info → pulumi_vsphere-4.13.0a1736849827.dist-info}/top_level.txt +0 -0
@@ -4,9 +4,14 @@
4
4
 
5
5
  import copy
6
6
  import warnings
7
+ import sys
7
8
  import pulumi
8
9
  import pulumi.runtime
9
10
  from typing import Any, Mapping, Optional, Sequence, Union, overload
11
+ if sys.version_info >= (3, 11):
12
+ from typing import NotRequired, TypedDict, TypeAlias
13
+ else:
14
+ from typing_extensions import NotRequired, TypedDict, TypeAlias
10
15
  from . import _utilities
11
16
 
12
17
  __all__ = ['ComputeClusterHostGroupArgs', 'ComputeClusterHostGroup']
@@ -168,7 +173,37 @@ class ComputeClusterHostGroup(pulumi.CustomResource):
168
173
  name: Optional[pulumi.Input[str]] = None,
169
174
  __props__=None):
170
175
  """
171
- Create a ComputeClusterHostGroup resource with the given unique name, props, and options.
176
+ The `ComputeClusterHostGroup` resource can be used to manage groups
177
+ of hosts in a cluster, either created by the
178
+ `ComputeCluster` resource or looked up
179
+ by the `ComputeCluster` data source.
180
+
181
+ This resource mainly serves as an input to the
182
+ `ComputeClusterVmHostRule`
183
+ resource - see the documentation for that resource for further details on how
184
+ to use host groups.
185
+
186
+ > **NOTE:** This resource requires vCenter and is not available on direct ESXi
187
+ connections.
188
+
189
+ ## Import
190
+
191
+ An existing group can be imported into this resource by
192
+
193
+ supplying both the path to the cluster, and the name of the host group. If the
194
+
195
+ name or cluster is not found, or if the group is of a different type, an error
196
+
197
+ will be returned. An example is below:
198
+
199
+ ```sh
200
+ $ pulumi import vsphere:index/computeClusterHostGroup:ComputeClusterHostGroup cluster_host_group \\
201
+ ```
202
+
203
+ '{"compute_cluster_path": "/dc1/host/cluster1", \\
204
+
205
+ "name": "pulumi-test-cluster-host-group"}'
206
+
172
207
  :param str resource_name: The name of the resource.
173
208
  :param pulumi.ResourceOptions opts: Options for the resource.
174
209
  :param pulumi.Input[str] compute_cluster_id: The managed object reference
@@ -191,7 +226,37 @@ class ComputeClusterHostGroup(pulumi.CustomResource):
191
226
  args: ComputeClusterHostGroupArgs,
192
227
  opts: Optional[pulumi.ResourceOptions] = None):
193
228
  """
194
- Create a ComputeClusterHostGroup resource with the given unique name, props, and options.
229
+ The `ComputeClusterHostGroup` resource can be used to manage groups
230
+ of hosts in a cluster, either created by the
231
+ `ComputeCluster` resource or looked up
232
+ by the `ComputeCluster` data source.
233
+
234
+ This resource mainly serves as an input to the
235
+ `ComputeClusterVmHostRule`
236
+ resource - see the documentation for that resource for further details on how
237
+ to use host groups.
238
+
239
+ > **NOTE:** This resource requires vCenter and is not available on direct ESXi
240
+ connections.
241
+
242
+ ## Import
243
+
244
+ An existing group can be imported into this resource by
245
+
246
+ supplying both the path to the cluster, and the name of the host group. If the
247
+
248
+ name or cluster is not found, or if the group is of a different type, an error
249
+
250
+ will be returned. An example is below:
251
+
252
+ ```sh
253
+ $ pulumi import vsphere:index/computeClusterHostGroup:ComputeClusterHostGroup cluster_host_group \\
254
+ ```
255
+
256
+ '{"compute_cluster_path": "/dc1/host/cluster1", \\
257
+
258
+ "name": "pulumi-test-cluster-host-group"}'
259
+
195
260
  :param str resource_name: The name of the resource.
196
261
  :param ComputeClusterHostGroupArgs args: The arguments to use to populate this resource's properties.
197
262
  :param pulumi.ResourceOptions opts: Options for the resource.
@@ -4,9 +4,14 @@
4
4
 
5
5
  import copy
6
6
  import warnings
7
+ import sys
7
8
  import pulumi
8
9
  import pulumi.runtime
9
10
  from typing import Any, Mapping, Optional, Sequence, Union, overload
11
+ if sys.version_info >= (3, 11):
12
+ from typing import NotRequired, TypedDict, TypeAlias
13
+ else:
14
+ from typing_extensions import NotRequired, TypedDict, TypeAlias
10
15
  from . import _utilities
11
16
 
12
17
  __all__ = ['ComputeClusterVmAffinityRuleArgs', 'ComputeClusterVmAffinityRule']
@@ -249,8 +254,6 @@ class ComputeClusterVmAffinityRule(pulumi.CustomResource):
249
254
  > **NOTE:** This resource requires vCenter Server and is not available on
250
255
  direct ESXi host connections.
251
256
 
252
- > **NOTE:** vSphere DRS requires a vSphere Enterprise Plus license.
253
-
254
257
  ## Example Usage
255
258
 
256
259
  The following example creates two virtual machines in a cluster using the
@@ -260,7 +263,6 @@ class ComputeClusterVmAffinityRule(pulumi.CustomResource):
260
263
  then creates an affinity rule for these two virtual machines, ensuring they
261
264
  will run on the same host whenever possible.
262
265
 
263
- <!--Start PulumiCodeChooser -->
264
266
  ```python
265
267
  import pulumi
266
268
  import pulumi_vsphere as vsphere
@@ -275,29 +277,29 @@ class ComputeClusterVmAffinityRule(pulumi.CustomResource):
275
277
  vm = []
276
278
  for range in [{"value": i} for i in range(0, 2)]:
277
279
  vm.append(vsphere.VirtualMachine(f"vm-{range['value']}",
280
+ name=f"foo-{range['value']}",
278
281
  resource_pool_id=cluster.resource_pool_id,
279
282
  datastore_id=datastore.id,
280
283
  num_cpus=1,
281
284
  memory=1024,
282
285
  guest_id="otherLinux64Guest",
283
- network_interfaces=[vsphere.VirtualMachineNetworkInterfaceArgs(
284
- network_id=network.id,
285
- )],
286
- disks=[vsphere.VirtualMachineDiskArgs(
287
- label="disk0",
288
- size=20,
289
- )]))
290
- vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vmAffinityRule",
286
+ network_interfaces=[{
287
+ "network_id": network.id,
288
+ }],
289
+ disks=[{
290
+ "label": "disk0",
291
+ "size": 20,
292
+ }]))
293
+ vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vm_affinity_rule",
294
+ name="vm-affinity-rule",
291
295
  compute_cluster_id=cluster.id,
292
296
  virtual_machine_ids=[v.id for k, v in vm])
293
297
  ```
294
- <!--End PulumiCodeChooser -->
295
298
 
296
299
  The following example creates an affinity rule for a set of virtual machines
297
300
  in the cluster by looking up the virtual machine UUIDs from the
298
301
  `VirtualMachine` data source.
299
302
 
300
- <!--Start PulumiCodeChooser -->
301
303
  ```python
302
304
  import pulumi
303
305
  import pulumi_vsphere as vsphere
@@ -309,14 +311,32 @@ class ComputeClusterVmAffinityRule(pulumi.CustomResource):
309
311
  datacenter = vsphere.get_datacenter(name="dc-01")
310
312
  cluster = vsphere.get_compute_cluster(name="cluster-01",
311
313
  datacenter_id=datacenter.id)
312
- vms_virtual_machine = [vsphere.get_virtual_machine(name=vms[__index],
314
+ vms_get_virtual_machine = [vsphere.get_virtual_machine(name=vms[__index],
313
315
  datacenter_id=datacenter.id) for __index in range(len(vms))]
314
- vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vmAffinityRule",
316
+ vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vm_affinity_rule",
317
+ name="vm-affinity-rule",
315
318
  enabled=True,
316
319
  compute_cluster_id=cluster.id,
317
- virtual_machine_ids=[__item.id for __item in vms_virtual_machine])
320
+ virtual_machine_ids=[__item.id for __item in vms_get_virtual_machine])
321
+ ```
322
+
323
+ ## Import
324
+
325
+ An existing rule can be imported into this resource by supplying
326
+
327
+ both the path to the cluster, and the name the rule. If the name or cluster is
328
+
329
+ not found, or if the rule is of a different type, an error will be returned. An
330
+
331
+ example is below:
332
+
333
+ ```sh
334
+ $ pulumi import vsphere:index/computeClusterVmAffinityRule:ComputeClusterVmAffinityRule vm_affinity_rule \\
318
335
  ```
319
- <!--End PulumiCodeChooser -->
336
+
337
+ '{"compute_cluster_path": "/dc-01/host/cluster-01", \\
338
+
339
+ "name": "vm-affinity-rule"}'
320
340
 
321
341
  :param str resource_name: The name of the resource.
322
342
  :param pulumi.ResourceOptions opts: Options for the resource.
@@ -361,8 +381,6 @@ class ComputeClusterVmAffinityRule(pulumi.CustomResource):
361
381
  > **NOTE:** This resource requires vCenter Server and is not available on
362
382
  direct ESXi host connections.
363
383
 
364
- > **NOTE:** vSphere DRS requires a vSphere Enterprise Plus license.
365
-
366
384
  ## Example Usage
367
385
 
368
386
  The following example creates two virtual machines in a cluster using the
@@ -372,7 +390,6 @@ class ComputeClusterVmAffinityRule(pulumi.CustomResource):
372
390
  then creates an affinity rule for these two virtual machines, ensuring they
373
391
  will run on the same host whenever possible.
374
392
 
375
- <!--Start PulumiCodeChooser -->
376
393
  ```python
377
394
  import pulumi
378
395
  import pulumi_vsphere as vsphere
@@ -387,29 +404,29 @@ class ComputeClusterVmAffinityRule(pulumi.CustomResource):
387
404
  vm = []
388
405
  for range in [{"value": i} for i in range(0, 2)]:
389
406
  vm.append(vsphere.VirtualMachine(f"vm-{range['value']}",
407
+ name=f"foo-{range['value']}",
390
408
  resource_pool_id=cluster.resource_pool_id,
391
409
  datastore_id=datastore.id,
392
410
  num_cpus=1,
393
411
  memory=1024,
394
412
  guest_id="otherLinux64Guest",
395
- network_interfaces=[vsphere.VirtualMachineNetworkInterfaceArgs(
396
- network_id=network.id,
397
- )],
398
- disks=[vsphere.VirtualMachineDiskArgs(
399
- label="disk0",
400
- size=20,
401
- )]))
402
- vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vmAffinityRule",
413
+ network_interfaces=[{
414
+ "network_id": network.id,
415
+ }],
416
+ disks=[{
417
+ "label": "disk0",
418
+ "size": 20,
419
+ }]))
420
+ vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vm_affinity_rule",
421
+ name="vm-affinity-rule",
403
422
  compute_cluster_id=cluster.id,
404
423
  virtual_machine_ids=[v.id for k, v in vm])
405
424
  ```
406
- <!--End PulumiCodeChooser -->
407
425
 
408
426
  The following example creates an affinity rule for a set of virtual machines
409
427
  in the cluster by looking up the virtual machine UUIDs from the
410
428
  `VirtualMachine` data source.
411
429
 
412
- <!--Start PulumiCodeChooser -->
413
430
  ```python
414
431
  import pulumi
415
432
  import pulumi_vsphere as vsphere
@@ -421,14 +438,32 @@ class ComputeClusterVmAffinityRule(pulumi.CustomResource):
421
438
  datacenter = vsphere.get_datacenter(name="dc-01")
422
439
  cluster = vsphere.get_compute_cluster(name="cluster-01",
423
440
  datacenter_id=datacenter.id)
424
- vms_virtual_machine = [vsphere.get_virtual_machine(name=vms[__index],
441
+ vms_get_virtual_machine = [vsphere.get_virtual_machine(name=vms[__index],
425
442
  datacenter_id=datacenter.id) for __index in range(len(vms))]
426
- vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vmAffinityRule",
443
+ vm_affinity_rule = vsphere.ComputeClusterVmAffinityRule("vm_affinity_rule",
444
+ name="vm-affinity-rule",
427
445
  enabled=True,
428
446
  compute_cluster_id=cluster.id,
429
- virtual_machine_ids=[__item.id for __item in vms_virtual_machine])
447
+ virtual_machine_ids=[__item.id for __item in vms_get_virtual_machine])
448
+ ```
449
+
450
+ ## Import
451
+
452
+ An existing rule can be imported into this resource by supplying
453
+
454
+ both the path to the cluster, and the name the rule. If the name or cluster is
455
+
456
+ not found, or if the rule is of a different type, an error will be returned. An
457
+
458
+ example is below:
459
+
460
+ ```sh
461
+ $ pulumi import vsphere:index/computeClusterVmAffinityRule:ComputeClusterVmAffinityRule vm_affinity_rule \\
430
462
  ```
431
- <!--End PulumiCodeChooser -->
463
+
464
+ '{"compute_cluster_path": "/dc-01/host/cluster-01", \\
465
+
466
+ "name": "vm-affinity-rule"}'
432
467
 
433
468
  :param str resource_name: The name of the resource.
434
469
  :param ComputeClusterVmAffinityRuleArgs args: The arguments to use to populate this resource's properties.
@@ -4,9 +4,14 @@
4
4
 
5
5
  import copy
6
6
  import warnings
7
+ import sys
7
8
  import pulumi
8
9
  import pulumi.runtime
9
10
  from typing import Any, Mapping, Optional, Sequence, Union, overload
11
+ if sys.version_info >= (3, 11):
12
+ from typing import NotRequired, TypedDict, TypeAlias
13
+ else:
14
+ from typing_extensions import NotRequired, TypedDict, TypeAlias
10
15
  from . import _utilities
11
16
 
12
17
  __all__ = ['ComputeClusterVmAntiAffinityRuleArgs', 'ComputeClusterVmAntiAffinityRule']
@@ -229,7 +234,24 @@ class ComputeClusterVmAntiAffinityRule(pulumi.CustomResource):
229
234
  virtual_machine_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
230
235
  __props__=None):
231
236
  """
232
- Create a ComputeClusterVmAntiAffinityRule resource with the given unique name, props, and options.
237
+ ## Import
238
+
239
+ An existing rule can be imported into this resource by supplying
240
+
241
+ both the path to the cluster, and the name the rule. If the name or cluster is
242
+
243
+ not found, or if the rule is of a different type, an error will be returned. An
244
+
245
+ example is below:
246
+
247
+ ```sh
248
+ $ pulumi import vsphere:index/computeClusterVmAntiAffinityRule:ComputeClusterVmAntiAffinityRule vm_anti_affinity_rule \\
249
+ ```
250
+
251
+ '{"compute_cluster_path": "/dc-01/host/cluster-01", \\
252
+
253
+ "name": "vm-anti-affinity-rule"}'
254
+
233
255
  :param str resource_name: The name of the resource.
234
256
  :param pulumi.ResourceOptions opts: Options for the resource.
235
257
  :param pulumi.Input[str] compute_cluster_id: The managed object reference
@@ -253,7 +275,24 @@ class ComputeClusterVmAntiAffinityRule(pulumi.CustomResource):
253
275
  args: ComputeClusterVmAntiAffinityRuleArgs,
254
276
  opts: Optional[pulumi.ResourceOptions] = None):
255
277
  """
256
- Create a ComputeClusterVmAntiAffinityRule resource with the given unique name, props, and options.
278
+ ## Import
279
+
280
+ An existing rule can be imported into this resource by supplying
281
+
282
+ both the path to the cluster, and the name the rule. If the name or cluster is
283
+
284
+ not found, or if the rule is of a different type, an error will be returned. An
285
+
286
+ example is below:
287
+
288
+ ```sh
289
+ $ pulumi import vsphere:index/computeClusterVmAntiAffinityRule:ComputeClusterVmAntiAffinityRule vm_anti_affinity_rule \\
290
+ ```
291
+
292
+ '{"compute_cluster_path": "/dc-01/host/cluster-01", \\
293
+
294
+ "name": "vm-anti-affinity-rule"}'
295
+
257
296
  :param str resource_name: The name of the resource.
258
297
  :param ComputeClusterVmAntiAffinityRuleArgs args: The arguments to use to populate this resource's properties.
259
298
  :param pulumi.ResourceOptions opts: Options for the resource.
@@ -4,9 +4,14 @@
4
4
 
5
5
  import copy
6
6
  import warnings
7
+ import sys
7
8
  import pulumi
8
9
  import pulumi.runtime
9
10
  from typing import Any, Mapping, Optional, Sequence, Union, overload
11
+ if sys.version_info >= (3, 11):
12
+ from typing import NotRequired, TypedDict, TypeAlias
13
+ else:
14
+ from typing_extensions import NotRequired, TypedDict, TypeAlias
10
15
  from . import _utilities
11
16
 
12
17
  __all__ = ['ComputeClusterVmDependencyRuleArgs', 'ComputeClusterVmDependencyRule']
@@ -285,7 +290,106 @@ class ComputeClusterVmDependencyRule(pulumi.CustomResource):
285
290
  vm_group_name: Optional[pulumi.Input[str]] = None,
286
291
  __props__=None):
287
292
  """
288
- Create a ComputeClusterVmDependencyRule resource with the given unique name, props, and options.
293
+ The `ComputeClusterVmDependencyRule` resource can be used to manage
294
+ VM dependency rules in a cluster, either created by the
295
+ `ComputeCluster` resource or looked up
296
+ by the `ComputeCluster` data source.
297
+
298
+ A virtual machine dependency rule applies to vSphere HA, and allows
299
+ user-defined startup orders for virtual machines in the case of host failure.
300
+ Virtual machines are supplied via groups, which can be managed via the
301
+ `ComputeClusterVmGroup`
302
+ resource.
303
+
304
+ > **NOTE:** This resource requires vCenter and is not available on direct ESXi
305
+ connections.
306
+
307
+ ## Example Usage
308
+
309
+ The example below creates two virtual machine in a cluster using the
310
+ `VirtualMachine` resource in a cluster
311
+ looked up by the `ComputeCluster`
312
+ data source. It then creates a group with this virtual machine. Two groups are created, each with one of the created VMs. Finally, a rule is created to ensure that `vm1` starts before `vm2`.
313
+
314
+ > Note how `dependency_vm_group_name` and
315
+ `vm_group_name` are sourced off of the `name` attributes from
316
+ the `ComputeClusterVmGroup`
317
+ resource. This is to ensure that the rule is not created before the groups
318
+ exist, which may not possibly happen in the event that the names came from a
319
+ "static" source such as a variable.
320
+
321
+ ```python
322
+ import pulumi
323
+ import pulumi_vsphere as vsphere
324
+
325
+ datacenter = vsphere.get_datacenter(name="dc-01")
326
+ datastore = vsphere.get_datastore(name="datastore1",
327
+ datacenter_id=datacenter.id)
328
+ cluster = vsphere.get_compute_cluster(name="cluster-01",
329
+ datacenter_id=datacenter.id)
330
+ network = vsphere.get_network(name="network1",
331
+ datacenter_id=datacenter.id)
332
+ vm1 = vsphere.VirtualMachine("vm1",
333
+ name="test1",
334
+ resource_pool_id=cluster.resource_pool_id,
335
+ datastore_id=datastore.id,
336
+ num_cpus=2,
337
+ memory=2048,
338
+ guest_id="otherLinux64Guest",
339
+ network_interfaces=[{
340
+ "network_id": network.id,
341
+ }],
342
+ disks=[{
343
+ "label": "disk0",
344
+ "size": 20,
345
+ }])
346
+ vm2 = vsphere.VirtualMachine("vm2",
347
+ name="test2",
348
+ resource_pool_id=cluster.resource_pool_id,
349
+ datastore_id=datastore.id,
350
+ num_cpus=2,
351
+ memory=2048,
352
+ guest_id="otherLinux64Guest",
353
+ network_interfaces=[{
354
+ "network_id": network.id,
355
+ }],
356
+ disks=[{
357
+ "label": "disk0",
358
+ "size": 20,
359
+ }])
360
+ cluster_vm_group1 = vsphere.ComputeClusterVmGroup("cluster_vm_group1",
361
+ name="test-cluster-vm-group1",
362
+ compute_cluster_id=cluster.id,
363
+ virtual_machine_ids=[vm1.id])
364
+ cluster_vm_group2 = vsphere.ComputeClusterVmGroup("cluster_vm_group2",
365
+ name="test-cluster-vm-group2",
366
+ compute_cluster_id=cluster.id,
367
+ virtual_machine_ids=[vm2.id])
368
+ cluster_vm_dependency_rule = vsphere.ComputeClusterVmDependencyRule("cluster_vm_dependency_rule",
369
+ compute_cluster_id=cluster.id,
370
+ name="test-cluster-vm-dependency-rule",
371
+ dependency_vm_group_name=cluster_vm_group1.name,
372
+ vm_group_name=cluster_vm_group2.name)
373
+ ```
374
+
375
+ ## Import
376
+
377
+ An existing rule can be imported into this resource by supplying
378
+
379
+ both the path to the cluster, and the name the rule. If the name or cluster is
380
+
381
+ not found, or if the rule is of a different type, an error will be returned. An
382
+
383
+ example is below:
384
+
385
+ ```sh
386
+ $ pulumi import vsphere:index/computeClusterVmDependencyRule:ComputeClusterVmDependencyRule cluster_vm_dependency_rule \\
387
+ ```
388
+
389
+ '{"compute_cluster_path": "/dc1/host/cluster1", \\
390
+
391
+ "name": "pulumi-test-cluster-vm-dependency-rule"}'
392
+
289
393
  :param str resource_name: The name of the resource.
290
394
  :param pulumi.ResourceOptions opts: Options for the resource.
291
395
  :param pulumi.Input[str] compute_cluster_id: The managed object reference
@@ -316,7 +420,106 @@ class ComputeClusterVmDependencyRule(pulumi.CustomResource):
316
420
  args: ComputeClusterVmDependencyRuleArgs,
317
421
  opts: Optional[pulumi.ResourceOptions] = None):
318
422
  """
319
- Create a ComputeClusterVmDependencyRule resource with the given unique name, props, and options.
423
+ The `ComputeClusterVmDependencyRule` resource can be used to manage
424
+ VM dependency rules in a cluster, either created by the
425
+ `ComputeCluster` resource or looked up
426
+ by the `ComputeCluster` data source.
427
+
428
+ A virtual machine dependency rule applies to vSphere HA, and allows
429
+ user-defined startup orders for virtual machines in the case of host failure.
430
+ Virtual machines are supplied via groups, which can be managed via the
431
+ `ComputeClusterVmGroup`
432
+ resource.
433
+
434
+ > **NOTE:** This resource requires vCenter and is not available on direct ESXi
435
+ connections.
436
+
437
+ ## Example Usage
438
+
439
+ The example below creates two virtual machine in a cluster using the
440
+ `VirtualMachine` resource in a cluster
441
+ looked up by the `ComputeCluster`
442
+ data source. It then creates a group with this virtual machine. Two groups are created, each with one of the created VMs. Finally, a rule is created to ensure that `vm1` starts before `vm2`.
443
+
444
+ > Note how `dependency_vm_group_name` and
445
+ `vm_group_name` are sourced off of the `name` attributes from
446
+ the `ComputeClusterVmGroup`
447
+ resource. This is to ensure that the rule is not created before the groups
448
+ exist, which may not possibly happen in the event that the names came from a
449
+ "static" source such as a variable.
450
+
451
+ ```python
452
+ import pulumi
453
+ import pulumi_vsphere as vsphere
454
+
455
+ datacenter = vsphere.get_datacenter(name="dc-01")
456
+ datastore = vsphere.get_datastore(name="datastore1",
457
+ datacenter_id=datacenter.id)
458
+ cluster = vsphere.get_compute_cluster(name="cluster-01",
459
+ datacenter_id=datacenter.id)
460
+ network = vsphere.get_network(name="network1",
461
+ datacenter_id=datacenter.id)
462
+ vm1 = vsphere.VirtualMachine("vm1",
463
+ name="test1",
464
+ resource_pool_id=cluster.resource_pool_id,
465
+ datastore_id=datastore.id,
466
+ num_cpus=2,
467
+ memory=2048,
468
+ guest_id="otherLinux64Guest",
469
+ network_interfaces=[{
470
+ "network_id": network.id,
471
+ }],
472
+ disks=[{
473
+ "label": "disk0",
474
+ "size": 20,
475
+ }])
476
+ vm2 = vsphere.VirtualMachine("vm2",
477
+ name="test2",
478
+ resource_pool_id=cluster.resource_pool_id,
479
+ datastore_id=datastore.id,
480
+ num_cpus=2,
481
+ memory=2048,
482
+ guest_id="otherLinux64Guest",
483
+ network_interfaces=[{
484
+ "network_id": network.id,
485
+ }],
486
+ disks=[{
487
+ "label": "disk0",
488
+ "size": 20,
489
+ }])
490
+ cluster_vm_group1 = vsphere.ComputeClusterVmGroup("cluster_vm_group1",
491
+ name="test-cluster-vm-group1",
492
+ compute_cluster_id=cluster.id,
493
+ virtual_machine_ids=[vm1.id])
494
+ cluster_vm_group2 = vsphere.ComputeClusterVmGroup("cluster_vm_group2",
495
+ name="test-cluster-vm-group2",
496
+ compute_cluster_id=cluster.id,
497
+ virtual_machine_ids=[vm2.id])
498
+ cluster_vm_dependency_rule = vsphere.ComputeClusterVmDependencyRule("cluster_vm_dependency_rule",
499
+ compute_cluster_id=cluster.id,
500
+ name="test-cluster-vm-dependency-rule",
501
+ dependency_vm_group_name=cluster_vm_group1.name,
502
+ vm_group_name=cluster_vm_group2.name)
503
+ ```
504
+
505
+ ## Import
506
+
507
+ An existing rule can be imported into this resource by supplying
508
+
509
+ both the path to the cluster, and the name the rule. If the name or cluster is
510
+
511
+ not found, or if the rule is of a different type, an error will be returned. An
512
+
513
+ example is below:
514
+
515
+ ```sh
516
+ $ pulumi import vsphere:index/computeClusterVmDependencyRule:ComputeClusterVmDependencyRule cluster_vm_dependency_rule \\
517
+ ```
518
+
519
+ '{"compute_cluster_path": "/dc1/host/cluster1", \\
520
+
521
+ "name": "pulumi-test-cluster-vm-dependency-rule"}'
522
+
320
523
  :param str resource_name: The name of the resource.
321
524
  :param ComputeClusterVmDependencyRuleArgs args: The arguments to use to populate this resource's properties.
322
525
  :param pulumi.ResourceOptions opts: Options for the resource.