pulumi-vsphere 4.10.0a1709017641__py3-none-any.whl → 4.17.0a1763710194__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.

Potentially problematic release.


This version of pulumi-vsphere might be problematic. Click here for more details.

Files changed (89) hide show
  1. pulumi_vsphere/__init__.py +51 -1
  2. pulumi_vsphere/_inputs.py +2568 -1025
  3. pulumi_vsphere/_utilities.py +50 -10
  4. pulumi_vsphere/compute_cluster.py +1564 -2373
  5. pulumi_vsphere/compute_cluster_host_group.py +191 -55
  6. pulumi_vsphere/compute_cluster_vm_affinity_rule.py +157 -113
  7. pulumi_vsphere/compute_cluster_vm_anti_affinity_rule.py +133 -89
  8. pulumi_vsphere/compute_cluster_vm_dependency_rule.py +314 -106
  9. pulumi_vsphere/compute_cluster_vm_group.py +256 -55
  10. pulumi_vsphere/compute_cluster_vm_host_rule.py +323 -123
  11. pulumi_vsphere/config/__init__.py +2 -1
  12. pulumi_vsphere/config/__init__.pyi +7 -2
  13. pulumi_vsphere/config/vars.py +20 -15
  14. pulumi_vsphere/configuration_profile.py +286 -0
  15. pulumi_vsphere/content_library.py +177 -71
  16. pulumi_vsphere/content_library_item.py +252 -106
  17. pulumi_vsphere/custom_attribute.py +118 -38
  18. pulumi_vsphere/datacenter.py +128 -107
  19. pulumi_vsphere/datastore_cluster.py +636 -731
  20. pulumi_vsphere/datastore_cluster_vm_anti_affinity_rule.py +251 -89
  21. pulumi_vsphere/distributed_port_group.py +1129 -967
  22. pulumi_vsphere/distributed_virtual_switch.py +1971 -2239
  23. pulumi_vsphere/distributed_virtual_switch_pvlan_mapping.py +294 -0
  24. pulumi_vsphere/dpm_host_override.py +222 -72
  25. pulumi_vsphere/drs_vm_override.py +236 -72
  26. pulumi_vsphere/entity_permissions.py +96 -69
  27. pulumi_vsphere/file.py +173 -178
  28. pulumi_vsphere/folder.py +236 -113
  29. pulumi_vsphere/get_compute_cluster.py +34 -23
  30. pulumi_vsphere/get_compute_cluster_host_group.py +52 -41
  31. pulumi_vsphere/get_configuration_profile.py +145 -0
  32. pulumi_vsphere/get_content_library.py +33 -21
  33. pulumi_vsphere/get_content_library_item.py +47 -31
  34. pulumi_vsphere/get_custom_attribute.py +26 -17
  35. pulumi_vsphere/get_datacenter.py +40 -18
  36. pulumi_vsphere/get_datastore.py +60 -24
  37. pulumi_vsphere/get_datastore_cluster.py +47 -22
  38. pulumi_vsphere/get_datastore_stats.py +204 -0
  39. pulumi_vsphere/get_distributed_virtual_switch.py +36 -23
  40. pulumi_vsphere/get_dynamic.py +55 -45
  41. pulumi_vsphere/get_folder.py +163 -25
  42. pulumi_vsphere/get_guest_os_customization.py +68 -37
  43. pulumi_vsphere/get_host.py +34 -23
  44. pulumi_vsphere/get_host_base_images.py +104 -0
  45. pulumi_vsphere/get_host_pci_device.py +78 -35
  46. pulumi_vsphere/get_host_thumbprint.py +58 -38
  47. pulumi_vsphere/get_host_vgpu_profile.py +195 -0
  48. pulumi_vsphere/get_license.py +44 -28
  49. pulumi_vsphere/get_network.py +157 -46
  50. pulumi_vsphere/get_ovf_vm_template.py +184 -301
  51. pulumi_vsphere/get_policy.py +23 -15
  52. pulumi_vsphere/get_resource_pool.py +107 -40
  53. pulumi_vsphere/get_role.py +49 -35
  54. pulumi_vsphere/get_tag.py +34 -23
  55. pulumi_vsphere/get_tag_category.py +32 -21
  56. pulumi_vsphere/get_vapp_container.py +31 -21
  57. pulumi_vsphere/get_virtual_machine.py +499 -287
  58. pulumi_vsphere/get_vmfs_disks.py +42 -29
  59. pulumi_vsphere/guest_os_customization.py +135 -79
  60. pulumi_vsphere/ha_vm_override.py +470 -577
  61. pulumi_vsphere/host.py +515 -262
  62. pulumi_vsphere/host_port_group.py +352 -355
  63. pulumi_vsphere/host_virtual_switch.py +580 -580
  64. pulumi_vsphere/license.py +110 -92
  65. pulumi_vsphere/nas_datastore.py +398 -270
  66. pulumi_vsphere/offline_software_depot.py +190 -0
  67. pulumi_vsphere/outputs.py +1582 -1027
  68. pulumi_vsphere/provider.py +172 -152
  69. pulumi_vsphere/pulumi-plugin.json +2 -1
  70. pulumi_vsphere/resource_pool.py +357 -273
  71. pulumi_vsphere/role.py +79 -47
  72. pulumi_vsphere/storage_drs_vm_override.py +225 -89
  73. pulumi_vsphere/supervisor.py +1064 -0
  74. pulumi_vsphere/tag.py +217 -55
  75. pulumi_vsphere/tag_category.py +158 -72
  76. pulumi_vsphere/vapp_container.py +425 -259
  77. pulumi_vsphere/vapp_entity.py +324 -174
  78. pulumi_vsphere/virtual_disk.py +245 -153
  79. pulumi_vsphere/virtual_machine.py +1696 -1836
  80. pulumi_vsphere/virtual_machine_class.py +448 -0
  81. pulumi_vsphere/virtual_machine_snapshot.py +137 -131
  82. pulumi_vsphere/vm_storage_policy.py +160 -154
  83. pulumi_vsphere/vmfs_datastore.py +460 -186
  84. pulumi_vsphere/vnic.py +249 -231
  85. {pulumi_vsphere-4.10.0a1709017641.dist-info → pulumi_vsphere-4.17.0a1763710194.dist-info}/METADATA +7 -6
  86. pulumi_vsphere-4.17.0a1763710194.dist-info/RECORD +89 -0
  87. {pulumi_vsphere-4.10.0a1709017641.dist-info → pulumi_vsphere-4.17.0a1763710194.dist-info}/WHEEL +1 -1
  88. pulumi_vsphere-4.10.0a1709017641.dist-info/RECORD +0 -80
  89. {pulumi_vsphere-4.10.0a1709017641.dist-info → pulumi_vsphere-4.17.0a1763710194.dist-info}/top_level.txt +0 -0
@@ -1,12 +1,17 @@
1
1
  # coding=utf-8
2
- # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
2
+ # *** WARNING: this file was generated by pulumi-language-python. ***
3
3
  # *** Do not edit by hand unless you're certain you know what you are doing! ***
4
4
 
5
- import copy
5
+ import builtins as _builtins
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__ = ['DatastoreClusterVmAntiAffinityRuleArgs', 'DatastoreClusterVmAntiAffinityRule']
@@ -14,24 +19,24 @@ __all__ = ['DatastoreClusterVmAntiAffinityRuleArgs', 'DatastoreClusterVmAntiAffi
14
19
  @pulumi.input_type
15
20
  class DatastoreClusterVmAntiAffinityRuleArgs:
16
21
  def __init__(__self__, *,
17
- datastore_cluster_id: pulumi.Input[str],
18
- virtual_machine_ids: pulumi.Input[Sequence[pulumi.Input[str]]],
19
- enabled: Optional[pulumi.Input[bool]] = None,
20
- mandatory: Optional[pulumi.Input[bool]] = None,
21
- name: Optional[pulumi.Input[str]] = None):
22
+ datastore_cluster_id: pulumi.Input[_builtins.str],
23
+ virtual_machine_ids: pulumi.Input[Sequence[pulumi.Input[_builtins.str]]],
24
+ enabled: Optional[pulumi.Input[_builtins.bool]] = None,
25
+ mandatory: Optional[pulumi.Input[_builtins.bool]] = None,
26
+ name: Optional[pulumi.Input[_builtins.str]] = None):
22
27
  """
23
28
  The set of arguments for constructing a DatastoreClusterVmAntiAffinityRule resource.
24
- :param pulumi.Input[str] datastore_cluster_id: The managed object reference
29
+ :param pulumi.Input[_builtins.str] datastore_cluster_id: The managed object reference
25
30
  ID of the datastore cluster to put the group in. Forces
26
31
  a new resource if changed.
27
- :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_machine_ids: The UUIDs of the virtual machines to run
32
+ :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] virtual_machine_ids: The UUIDs of the virtual machines to run
28
33
  on different datastores from each other.
29
34
 
30
35
  > **NOTE:** The minimum length of `virtual_machine_ids` is 2.
31
- :param pulumi.Input[bool] enabled: Enable this rule in the cluster. Default: `true`.
32
- :param pulumi.Input[bool] mandatory: When this value is `true`, prevents any virtual
36
+ :param pulumi.Input[_builtins.bool] enabled: Enable this rule in the cluster. Default: `true`.
37
+ :param pulumi.Input[_builtins.bool] mandatory: When this value is `true`, prevents any virtual
33
38
  machine operations that may violate this rule. Default: `false`.
34
- :param pulumi.Input[str] name: The name of the rule. This must be unique in the cluster.
39
+ :param pulumi.Input[_builtins.str] name: The name of the rule. This must be unique in the cluster.
35
40
  """
36
41
  pulumi.set(__self__, "datastore_cluster_id", datastore_cluster_id)
37
42
  pulumi.set(__self__, "virtual_machine_ids", virtual_machine_ids)
@@ -42,9 +47,9 @@ class DatastoreClusterVmAntiAffinityRuleArgs:
42
47
  if name is not None:
43
48
  pulumi.set(__self__, "name", name)
44
49
 
45
- @property
50
+ @_builtins.property
46
51
  @pulumi.getter(name="datastoreClusterId")
47
- def datastore_cluster_id(self) -> pulumi.Input[str]:
52
+ def datastore_cluster_id(self) -> pulumi.Input[_builtins.str]:
48
53
  """
49
54
  The managed object reference
50
55
  ID of the datastore cluster to put the group in. Forces
@@ -53,12 +58,12 @@ class DatastoreClusterVmAntiAffinityRuleArgs:
53
58
  return pulumi.get(self, "datastore_cluster_id")
54
59
 
55
60
  @datastore_cluster_id.setter
56
- def datastore_cluster_id(self, value: pulumi.Input[str]):
61
+ def datastore_cluster_id(self, value: pulumi.Input[_builtins.str]):
57
62
  pulumi.set(self, "datastore_cluster_id", value)
58
63
 
59
- @property
64
+ @_builtins.property
60
65
  @pulumi.getter(name="virtualMachineIds")
61
- def virtual_machine_ids(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
66
+ def virtual_machine_ids(self) -> pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]:
62
67
  """
63
68
  The UUIDs of the virtual machines to run
64
69
  on different datastores from each other.
@@ -68,24 +73,24 @@ class DatastoreClusterVmAntiAffinityRuleArgs:
68
73
  return pulumi.get(self, "virtual_machine_ids")
69
74
 
70
75
  @virtual_machine_ids.setter
71
- def virtual_machine_ids(self, value: pulumi.Input[Sequence[pulumi.Input[str]]]):
76
+ def virtual_machine_ids(self, value: pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]):
72
77
  pulumi.set(self, "virtual_machine_ids", value)
73
78
 
74
- @property
79
+ @_builtins.property
75
80
  @pulumi.getter
76
- def enabled(self) -> Optional[pulumi.Input[bool]]:
81
+ def enabled(self) -> Optional[pulumi.Input[_builtins.bool]]:
77
82
  """
78
83
  Enable this rule in the cluster. Default: `true`.
79
84
  """
80
85
  return pulumi.get(self, "enabled")
81
86
 
82
87
  @enabled.setter
83
- def enabled(self, value: Optional[pulumi.Input[bool]]):
88
+ def enabled(self, value: Optional[pulumi.Input[_builtins.bool]]):
84
89
  pulumi.set(self, "enabled", value)
85
90
 
86
- @property
91
+ @_builtins.property
87
92
  @pulumi.getter
88
- def mandatory(self) -> Optional[pulumi.Input[bool]]:
93
+ def mandatory(self) -> Optional[pulumi.Input[_builtins.bool]]:
89
94
  """
90
95
  When this value is `true`, prevents any virtual
91
96
  machine operations that may violate this rule. Default: `false`.
@@ -93,40 +98,40 @@ class DatastoreClusterVmAntiAffinityRuleArgs:
93
98
  return pulumi.get(self, "mandatory")
94
99
 
95
100
  @mandatory.setter
96
- def mandatory(self, value: Optional[pulumi.Input[bool]]):
101
+ def mandatory(self, value: Optional[pulumi.Input[_builtins.bool]]):
97
102
  pulumi.set(self, "mandatory", value)
98
103
 
99
- @property
104
+ @_builtins.property
100
105
  @pulumi.getter
101
- def name(self) -> Optional[pulumi.Input[str]]:
106
+ def name(self) -> Optional[pulumi.Input[_builtins.str]]:
102
107
  """
103
108
  The name of the rule. This must be unique in the cluster.
104
109
  """
105
110
  return pulumi.get(self, "name")
106
111
 
107
112
  @name.setter
108
- def name(self, value: Optional[pulumi.Input[str]]):
113
+ def name(self, value: Optional[pulumi.Input[_builtins.str]]):
109
114
  pulumi.set(self, "name", value)
110
115
 
111
116
 
112
117
  @pulumi.input_type
113
118
  class _DatastoreClusterVmAntiAffinityRuleState:
114
119
  def __init__(__self__, *,
115
- datastore_cluster_id: Optional[pulumi.Input[str]] = None,
116
- enabled: Optional[pulumi.Input[bool]] = None,
117
- mandatory: Optional[pulumi.Input[bool]] = None,
118
- name: Optional[pulumi.Input[str]] = None,
119
- virtual_machine_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
120
+ datastore_cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
121
+ enabled: Optional[pulumi.Input[_builtins.bool]] = None,
122
+ mandatory: Optional[pulumi.Input[_builtins.bool]] = None,
123
+ name: Optional[pulumi.Input[_builtins.str]] = None,
124
+ virtual_machine_ids: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None):
120
125
  """
121
126
  Input properties used for looking up and filtering DatastoreClusterVmAntiAffinityRule resources.
122
- :param pulumi.Input[str] datastore_cluster_id: The managed object reference
127
+ :param pulumi.Input[_builtins.str] datastore_cluster_id: The managed object reference
123
128
  ID of the datastore cluster to put the group in. Forces
124
129
  a new resource if changed.
125
- :param pulumi.Input[bool] enabled: Enable this rule in the cluster. Default: `true`.
126
- :param pulumi.Input[bool] mandatory: When this value is `true`, prevents any virtual
130
+ :param pulumi.Input[_builtins.bool] enabled: Enable this rule in the cluster. Default: `true`.
131
+ :param pulumi.Input[_builtins.bool] mandatory: When this value is `true`, prevents any virtual
127
132
  machine operations that may violate this rule. Default: `false`.
128
- :param pulumi.Input[str] name: The name of the rule. This must be unique in the cluster.
129
- :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_machine_ids: The UUIDs of the virtual machines to run
133
+ :param pulumi.Input[_builtins.str] name: The name of the rule. This must be unique in the cluster.
134
+ :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] virtual_machine_ids: The UUIDs of the virtual machines to run
130
135
  on different datastores from each other.
131
136
 
132
137
  > **NOTE:** The minimum length of `virtual_machine_ids` is 2.
@@ -142,9 +147,9 @@ class _DatastoreClusterVmAntiAffinityRuleState:
142
147
  if virtual_machine_ids is not None:
143
148
  pulumi.set(__self__, "virtual_machine_ids", virtual_machine_ids)
144
149
 
145
- @property
150
+ @_builtins.property
146
151
  @pulumi.getter(name="datastoreClusterId")
147
- def datastore_cluster_id(self) -> Optional[pulumi.Input[str]]:
152
+ def datastore_cluster_id(self) -> Optional[pulumi.Input[_builtins.str]]:
148
153
  """
149
154
  The managed object reference
150
155
  ID of the datastore cluster to put the group in. Forces
@@ -153,24 +158,24 @@ class _DatastoreClusterVmAntiAffinityRuleState:
153
158
  return pulumi.get(self, "datastore_cluster_id")
154
159
 
155
160
  @datastore_cluster_id.setter
156
- def datastore_cluster_id(self, value: Optional[pulumi.Input[str]]):
161
+ def datastore_cluster_id(self, value: Optional[pulumi.Input[_builtins.str]]):
157
162
  pulumi.set(self, "datastore_cluster_id", value)
158
163
 
159
- @property
164
+ @_builtins.property
160
165
  @pulumi.getter
161
- def enabled(self) -> Optional[pulumi.Input[bool]]:
166
+ def enabled(self) -> Optional[pulumi.Input[_builtins.bool]]:
162
167
  """
163
168
  Enable this rule in the cluster. Default: `true`.
164
169
  """
165
170
  return pulumi.get(self, "enabled")
166
171
 
167
172
  @enabled.setter
168
- def enabled(self, value: Optional[pulumi.Input[bool]]):
173
+ def enabled(self, value: Optional[pulumi.Input[_builtins.bool]]):
169
174
  pulumi.set(self, "enabled", value)
170
175
 
171
- @property
176
+ @_builtins.property
172
177
  @pulumi.getter
173
- def mandatory(self) -> Optional[pulumi.Input[bool]]:
178
+ def mandatory(self) -> Optional[pulumi.Input[_builtins.bool]]:
174
179
  """
175
180
  When this value is `true`, prevents any virtual
176
181
  machine operations that may violate this rule. Default: `false`.
@@ -178,24 +183,24 @@ class _DatastoreClusterVmAntiAffinityRuleState:
178
183
  return pulumi.get(self, "mandatory")
179
184
 
180
185
  @mandatory.setter
181
- def mandatory(self, value: Optional[pulumi.Input[bool]]):
186
+ def mandatory(self, value: Optional[pulumi.Input[_builtins.bool]]):
182
187
  pulumi.set(self, "mandatory", value)
183
188
 
184
- @property
189
+ @_builtins.property
185
190
  @pulumi.getter
186
- def name(self) -> Optional[pulumi.Input[str]]:
191
+ def name(self) -> Optional[pulumi.Input[_builtins.str]]:
187
192
  """
188
193
  The name of the rule. This must be unique in the cluster.
189
194
  """
190
195
  return pulumi.get(self, "name")
191
196
 
192
197
  @name.setter
193
- def name(self, value: Optional[pulumi.Input[str]]):
198
+ def name(self, value: Optional[pulumi.Input[_builtins.str]]):
194
199
  pulumi.set(self, "name", value)
195
200
 
196
- @property
201
+ @_builtins.property
197
202
  @pulumi.getter(name="virtualMachineIds")
198
- def virtual_machine_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
203
+ def virtual_machine_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]]:
199
204
  """
200
205
  The UUIDs of the virtual machines to run
201
206
  on different datastores from each other.
@@ -205,33 +210,112 @@ class _DatastoreClusterVmAntiAffinityRuleState:
205
210
  return pulumi.get(self, "virtual_machine_ids")
206
211
 
207
212
  @virtual_machine_ids.setter
208
- def virtual_machine_ids(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
213
+ def virtual_machine_ids(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]]):
209
214
  pulumi.set(self, "virtual_machine_ids", value)
210
215
 
211
216
 
217
+ @pulumi.type_token("vsphere:index/datastoreClusterVmAntiAffinityRule:DatastoreClusterVmAntiAffinityRule")
212
218
  class DatastoreClusterVmAntiAffinityRule(pulumi.CustomResource):
213
219
  @overload
214
220
  def __init__(__self__,
215
221
  resource_name: str,
216
222
  opts: Optional[pulumi.ResourceOptions] = None,
217
- datastore_cluster_id: Optional[pulumi.Input[str]] = None,
218
- enabled: Optional[pulumi.Input[bool]] = None,
219
- mandatory: Optional[pulumi.Input[bool]] = None,
220
- name: Optional[pulumi.Input[str]] = None,
221
- virtual_machine_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
223
+ datastore_cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
224
+ enabled: Optional[pulumi.Input[_builtins.bool]] = None,
225
+ mandatory: Optional[pulumi.Input[_builtins.bool]] = None,
226
+ name: Optional[pulumi.Input[_builtins.str]] = None,
227
+ virtual_machine_ids: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
222
228
  __props__=None):
223
229
  """
224
- Create a DatastoreClusterVmAntiAffinityRule resource with the given unique name, props, and options.
230
+ The `DatastoreClusterVmAntiAffinityRule` resource can be used to
231
+ manage VM anti-affinity rules in a datastore cluster, either created by the
232
+ `DatastoreCluster` resource or looked up
233
+ by the `DatastoreCluster` data source.
234
+
235
+ This rule can be used to tell a set to virtual machines to run on different
236
+ datastores within a cluster, useful for preventing single points of failure in
237
+ application cluster scenarios. When configured, Storage DRS will make a best effort to
238
+ ensure that the virtual machines run on different datastores, or prevent any
239
+ operation that would keep that from happening, depending on the value of the
240
+ `mandatory` flag.
241
+
242
+ > **NOTE:** This resource requires vCenter and is not available on direct ESXi
243
+ connections.
244
+
245
+ > **NOTE:** Storage DRS requires a vSphere Enterprise Plus license.
246
+
247
+ ## Example Usage
248
+
249
+ The example below creates two virtual machines in a cluster using the
250
+ `VirtualMachine` resource, creating the
251
+ virtual machines in the datastore cluster looked up by the
252
+ `DatastoreCluster` data
253
+ source. It then creates an anti-affinity rule for these two virtual machines,
254
+ ensuring they will run on different datastores whenever possible.
255
+
256
+ ```python
257
+ import pulumi
258
+ import pulumi_vsphere as vsphere
259
+
260
+ datacenter = vsphere.get_datacenter(name="dc-01")
261
+ datastore_cluster = vsphere.get_datastore_cluster(name="datastore-cluster1",
262
+ datacenter_id=datacenter.id)
263
+ cluster = vsphere.get_compute_cluster(name="cluster-01",
264
+ datacenter_id=datacenter.id)
265
+ network = vsphere.get_network(name="network1",
266
+ datacenter_id=datacenter.id)
267
+ vm = []
268
+ for range in [{"value": i} for i in range(0, 2)]:
269
+ vm.append(vsphere.VirtualMachine(f"vm-{range['value']}",
270
+ name=f"test-{range['value']}",
271
+ resource_pool_id=cluster.resource_pool_id,
272
+ datastore_cluster_id=datastore_cluster.id,
273
+ num_cpus=2,
274
+ memory=2048,
275
+ guest_id="otherLinux64Guest",
276
+ network_interfaces=[{
277
+ "network_id": network.id,
278
+ }],
279
+ disks=[{
280
+ "label": "disk0",
281
+ "size": 20,
282
+ }]))
283
+ cluster_vm_anti_affinity_rule = vsphere.DatastoreClusterVmAntiAffinityRule("cluster_vm_anti_affinity_rule",
284
+ name="test-datastore-cluster-vm-anti-affinity-rule",
285
+ datastore_cluster_id=datastore_cluster.id,
286
+ virtual_machine_ids=[[__item.id for __item in vm]])
287
+ ```
288
+
289
+ ## Import
290
+
291
+ An existing rule can be imported into this resource by supplying
292
+
293
+ both the path to the cluster, and the name the rule. If the name or cluster is
294
+
295
+ not found, or if the rule is of a different type, an error will be returned. An
296
+
297
+ example is below:
298
+
299
+ [docs-import]: https://developer.hashicorp.com/terraform/cli/import
300
+
301
+ ```sh
302
+ $ pulumi import vsphere:index/datastoreClusterVmAntiAffinityRule:DatastoreClusterVmAntiAffinityRule cluster_vm_anti_affinity_rule \\
303
+ ```
304
+
305
+ '{"compute_cluster_path": "/dc1/datastore/cluster1", \\
306
+
307
+ "name": "pulumi-test-datastore-cluster-vm-anti-affinity-rule"}'
308
+
225
309
  :param str resource_name: The name of the resource.
226
310
  :param pulumi.ResourceOptions opts: Options for the resource.
227
- :param pulumi.Input[str] datastore_cluster_id: The managed object reference
311
+ :param pulumi.Input[_builtins.str] datastore_cluster_id: The managed object reference
228
312
  ID of the datastore cluster to put the group in. Forces
229
313
  a new resource if changed.
230
- :param pulumi.Input[bool] enabled: Enable this rule in the cluster. Default: `true`.
231
- :param pulumi.Input[bool] mandatory: When this value is `true`, prevents any virtual
314
+ :param pulumi.Input[_builtins.bool] enabled: Enable this rule in the cluster. Default: `true`.
315
+ :param pulumi.Input[_builtins.bool] mandatory: When this value is `true`, prevents any virtual
232
316
  machine operations that may violate this rule. Default: `false`.
233
- :param pulumi.Input[str] name: The name of the rule. This must be unique in the cluster.
234
- :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_machine_ids: The UUIDs of the virtual machines to run
317
+ :param pulumi.Input[_builtins.str] name: The name of the rule. This must be unique in the cluster.
318
+ :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] virtual_machine_ids: The UUIDs of the virtual machines to run
235
319
  on different datastores from each other.
236
320
 
237
321
  > **NOTE:** The minimum length of `virtual_machine_ids` is 2.
@@ -243,7 +327,85 @@ class DatastoreClusterVmAntiAffinityRule(pulumi.CustomResource):
243
327
  args: DatastoreClusterVmAntiAffinityRuleArgs,
244
328
  opts: Optional[pulumi.ResourceOptions] = None):
245
329
  """
246
- Create a DatastoreClusterVmAntiAffinityRule resource with the given unique name, props, and options.
330
+ The `DatastoreClusterVmAntiAffinityRule` resource can be used to
331
+ manage VM anti-affinity rules in a datastore cluster, either created by the
332
+ `DatastoreCluster` resource or looked up
333
+ by the `DatastoreCluster` data source.
334
+
335
+ This rule can be used to tell a set to virtual machines to run on different
336
+ datastores within a cluster, useful for preventing single points of failure in
337
+ application cluster scenarios. When configured, Storage DRS will make a best effort to
338
+ ensure that the virtual machines run on different datastores, or prevent any
339
+ operation that would keep that from happening, depending on the value of the
340
+ `mandatory` flag.
341
+
342
+ > **NOTE:** This resource requires vCenter and is not available on direct ESXi
343
+ connections.
344
+
345
+ > **NOTE:** Storage DRS requires a vSphere Enterprise Plus license.
346
+
347
+ ## Example Usage
348
+
349
+ The example below creates two virtual machines in a cluster using the
350
+ `VirtualMachine` resource, creating the
351
+ virtual machines in the datastore cluster looked up by the
352
+ `DatastoreCluster` data
353
+ source. It then creates an anti-affinity rule for these two virtual machines,
354
+ ensuring they will run on different datastores whenever possible.
355
+
356
+ ```python
357
+ import pulumi
358
+ import pulumi_vsphere as vsphere
359
+
360
+ datacenter = vsphere.get_datacenter(name="dc-01")
361
+ datastore_cluster = vsphere.get_datastore_cluster(name="datastore-cluster1",
362
+ datacenter_id=datacenter.id)
363
+ cluster = vsphere.get_compute_cluster(name="cluster-01",
364
+ datacenter_id=datacenter.id)
365
+ network = vsphere.get_network(name="network1",
366
+ datacenter_id=datacenter.id)
367
+ vm = []
368
+ for range in [{"value": i} for i in range(0, 2)]:
369
+ vm.append(vsphere.VirtualMachine(f"vm-{range['value']}",
370
+ name=f"test-{range['value']}",
371
+ resource_pool_id=cluster.resource_pool_id,
372
+ datastore_cluster_id=datastore_cluster.id,
373
+ num_cpus=2,
374
+ memory=2048,
375
+ guest_id="otherLinux64Guest",
376
+ network_interfaces=[{
377
+ "network_id": network.id,
378
+ }],
379
+ disks=[{
380
+ "label": "disk0",
381
+ "size": 20,
382
+ }]))
383
+ cluster_vm_anti_affinity_rule = vsphere.DatastoreClusterVmAntiAffinityRule("cluster_vm_anti_affinity_rule",
384
+ name="test-datastore-cluster-vm-anti-affinity-rule",
385
+ datastore_cluster_id=datastore_cluster.id,
386
+ virtual_machine_ids=[[__item.id for __item in vm]])
387
+ ```
388
+
389
+ ## Import
390
+
391
+ An existing rule can be imported into this resource by supplying
392
+
393
+ both the path to the cluster, and the name the rule. If the name or cluster is
394
+
395
+ not found, or if the rule is of a different type, an error will be returned. An
396
+
397
+ example is below:
398
+
399
+ [docs-import]: https://developer.hashicorp.com/terraform/cli/import
400
+
401
+ ```sh
402
+ $ pulumi import vsphere:index/datastoreClusterVmAntiAffinityRule:DatastoreClusterVmAntiAffinityRule cluster_vm_anti_affinity_rule \\
403
+ ```
404
+
405
+ '{"compute_cluster_path": "/dc1/datastore/cluster1", \\
406
+
407
+ "name": "pulumi-test-datastore-cluster-vm-anti-affinity-rule"}'
408
+
247
409
  :param str resource_name: The name of the resource.
248
410
  :param DatastoreClusterVmAntiAffinityRuleArgs args: The arguments to use to populate this resource's properties.
249
411
  :param pulumi.ResourceOptions opts: Options for the resource.
@@ -259,11 +421,11 @@ class DatastoreClusterVmAntiAffinityRule(pulumi.CustomResource):
259
421
  def _internal_init(__self__,
260
422
  resource_name: str,
261
423
  opts: Optional[pulumi.ResourceOptions] = None,
262
- datastore_cluster_id: Optional[pulumi.Input[str]] = None,
263
- enabled: Optional[pulumi.Input[bool]] = None,
264
- mandatory: Optional[pulumi.Input[bool]] = None,
265
- name: Optional[pulumi.Input[str]] = None,
266
- virtual_machine_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
424
+ datastore_cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
425
+ enabled: Optional[pulumi.Input[_builtins.bool]] = None,
426
+ mandatory: Optional[pulumi.Input[_builtins.bool]] = None,
427
+ name: Optional[pulumi.Input[_builtins.str]] = None,
428
+ virtual_machine_ids: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
267
429
  __props__=None):
268
430
  opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
269
431
  if not isinstance(opts, pulumi.ResourceOptions):
@@ -292,11 +454,11 @@ class DatastoreClusterVmAntiAffinityRule(pulumi.CustomResource):
292
454
  def get(resource_name: str,
293
455
  id: pulumi.Input[str],
294
456
  opts: Optional[pulumi.ResourceOptions] = None,
295
- datastore_cluster_id: Optional[pulumi.Input[str]] = None,
296
- enabled: Optional[pulumi.Input[bool]] = None,
297
- mandatory: Optional[pulumi.Input[bool]] = None,
298
- name: Optional[pulumi.Input[str]] = None,
299
- virtual_machine_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None) -> 'DatastoreClusterVmAntiAffinityRule':
457
+ datastore_cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
458
+ enabled: Optional[pulumi.Input[_builtins.bool]] = None,
459
+ mandatory: Optional[pulumi.Input[_builtins.bool]] = None,
460
+ name: Optional[pulumi.Input[_builtins.str]] = None,
461
+ virtual_machine_ids: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None) -> 'DatastoreClusterVmAntiAffinityRule':
300
462
  """
301
463
  Get an existing DatastoreClusterVmAntiAffinityRule resource's state with the given name, id, and optional extra
302
464
  properties used to qualify the lookup.
@@ -304,14 +466,14 @@ class DatastoreClusterVmAntiAffinityRule(pulumi.CustomResource):
304
466
  :param str resource_name: The unique name of the resulting resource.
305
467
  :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
306
468
  :param pulumi.ResourceOptions opts: Options for the resource.
307
- :param pulumi.Input[str] datastore_cluster_id: The managed object reference
469
+ :param pulumi.Input[_builtins.str] datastore_cluster_id: The managed object reference
308
470
  ID of the datastore cluster to put the group in. Forces
309
471
  a new resource if changed.
310
- :param pulumi.Input[bool] enabled: Enable this rule in the cluster. Default: `true`.
311
- :param pulumi.Input[bool] mandatory: When this value is `true`, prevents any virtual
472
+ :param pulumi.Input[_builtins.bool] enabled: Enable this rule in the cluster. Default: `true`.
473
+ :param pulumi.Input[_builtins.bool] mandatory: When this value is `true`, prevents any virtual
312
474
  machine operations that may violate this rule. Default: `false`.
313
- :param pulumi.Input[str] name: The name of the rule. This must be unique in the cluster.
314
- :param pulumi.Input[Sequence[pulumi.Input[str]]] virtual_machine_ids: The UUIDs of the virtual machines to run
475
+ :param pulumi.Input[_builtins.str] name: The name of the rule. This must be unique in the cluster.
476
+ :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] virtual_machine_ids: The UUIDs of the virtual machines to run
315
477
  on different datastores from each other.
316
478
 
317
479
  > **NOTE:** The minimum length of `virtual_machine_ids` is 2.
@@ -327,9 +489,9 @@ class DatastoreClusterVmAntiAffinityRule(pulumi.CustomResource):
327
489
  __props__.__dict__["virtual_machine_ids"] = virtual_machine_ids
328
490
  return DatastoreClusterVmAntiAffinityRule(resource_name, opts=opts, __props__=__props__)
329
491
 
330
- @property
492
+ @_builtins.property
331
493
  @pulumi.getter(name="datastoreClusterId")
332
- def datastore_cluster_id(self) -> pulumi.Output[str]:
494
+ def datastore_cluster_id(self) -> pulumi.Output[_builtins.str]:
333
495
  """
334
496
  The managed object reference
335
497
  ID of the datastore cluster to put the group in. Forces
@@ -337,34 +499,34 @@ class DatastoreClusterVmAntiAffinityRule(pulumi.CustomResource):
337
499
  """
338
500
  return pulumi.get(self, "datastore_cluster_id")
339
501
 
340
- @property
502
+ @_builtins.property
341
503
  @pulumi.getter
342
- def enabled(self) -> pulumi.Output[Optional[bool]]:
504
+ def enabled(self) -> pulumi.Output[Optional[_builtins.bool]]:
343
505
  """
344
506
  Enable this rule in the cluster. Default: `true`.
345
507
  """
346
508
  return pulumi.get(self, "enabled")
347
509
 
348
- @property
510
+ @_builtins.property
349
511
  @pulumi.getter
350
- def mandatory(self) -> pulumi.Output[Optional[bool]]:
512
+ def mandatory(self) -> pulumi.Output[Optional[_builtins.bool]]:
351
513
  """
352
514
  When this value is `true`, prevents any virtual
353
515
  machine operations that may violate this rule. Default: `false`.
354
516
  """
355
517
  return pulumi.get(self, "mandatory")
356
518
 
357
- @property
519
+ @_builtins.property
358
520
  @pulumi.getter
359
- def name(self) -> pulumi.Output[str]:
521
+ def name(self) -> pulumi.Output[_builtins.str]:
360
522
  """
361
523
  The name of the rule. This must be unique in the cluster.
362
524
  """
363
525
  return pulumi.get(self, "name")
364
526
 
365
- @property
527
+ @_builtins.property
366
528
  @pulumi.getter(name="virtualMachineIds")
367
- def virtual_machine_ids(self) -> pulumi.Output[Sequence[str]]:
529
+ def virtual_machine_ids(self) -> pulumi.Output[Sequence[_builtins.str]]:
368
530
  """
369
531
  The UUIDs of the virtual machines to run
370
532
  on different datastores from each other.