vsphere.DatastoreClusterVmAntiAffinityRule
Explore with Pulumi AI
The vsphere.DatastoreClusterVmAntiAffinityRule
resource can be used to
manage VM anti-affinity rules in a datastore cluster, either created by the
vsphere.DatastoreCluster
resource or looked up
by the vsphere.DatastoreCluster
data source.
This rule can be used to tell a set to virtual machines to run on different
datastores within a cluster, useful for preventing single points of failure in
application cluster scenarios. When configured, Storage DRS will make a best effort to
ensure that the virtual machines run on different datastores, or prevent any
operation that would keep that from happening, depending on the value of the
mandatory
flag.
NOTE: This resource requires vCenter and is not available on direct ESXi connections.
NOTE: Storage DRS requires a vSphere Enterprise Plus license.
Example Usage
The example below creates two virtual machines in a cluster using the
vsphere.VirtualMachine
resource, creating the
virtual machines in the datastore cluster looked up by the
vsphere.DatastoreCluster
data
source. It then creates an anti-affinity rule for these two virtual machines,
ensuring they will run on different datastores whenever possible.
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const datacenter = vsphere.getDatacenter({
name: "dc-01",
});
const datastoreCluster = datacenter.then(datacenter => vsphere.getDatastoreCluster({
name: "datastore-cluster1",
datacenterId: datacenter.id,
}));
const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({
name: "cluster-01",
datacenterId: datacenter.id,
}));
const network = datacenter.then(datacenter => vsphere.getNetwork({
name: "network1",
datacenterId: datacenter.id,
}));
const vm: vsphere.VirtualMachine[] = [];
for (const range = {value: 0}; range.value < 2; range.value++) {
vm.push(new vsphere.VirtualMachine(`vm-${range.value}`, {
name: `test-${range.value}`,
resourcePoolId: cluster.then(cluster => cluster.resourcePoolId),
datastoreClusterId: datastoreCluster.then(datastoreCluster => datastoreCluster.id),
numCpus: 2,
memory: 2048,
guestId: "otherLinux64Guest",
networkInterfaces: [{
networkId: network.then(network => network.id),
}],
disks: [{
label: "disk0",
size: 20,
}],
}));
}
const clusterVmAntiAffinityRule = new vsphere.DatastoreClusterVmAntiAffinityRule("cluster_vm_anti_affinity_rule", {
name: "test-datastore-cluster-vm-anti-affinity-rule",
datastoreClusterId: datastoreCluster.then(datastoreCluster => datastoreCluster.id),
virtualMachineIds: [vm.map(__item => __item.id)],
});
import pulumi
import pulumi_vsphere as vsphere
datacenter = vsphere.get_datacenter(name="dc-01")
datastore_cluster = vsphere.get_datastore_cluster(name="datastore-cluster1",
datacenter_id=datacenter.id)
cluster = vsphere.get_compute_cluster(name="cluster-01",
datacenter_id=datacenter.id)
network = vsphere.get_network(name="network1",
datacenter_id=datacenter.id)
vm = []
for range in [{"value": i} for i in range(0, 2)]:
vm.append(vsphere.VirtualMachine(f"vm-{range['value']}",
name=f"test-{range['value']}",
resource_pool_id=cluster.resource_pool_id,
datastore_cluster_id=datastore_cluster.id,
num_cpus=2,
memory=2048,
guest_id="otherLinux64Guest",
network_interfaces=[{
"network_id": network.id,
}],
disks=[{
"label": "disk0",
"size": 20,
}]))
cluster_vm_anti_affinity_rule = vsphere.DatastoreClusterVmAntiAffinityRule("cluster_vm_anti_affinity_rule",
name="test-datastore-cluster-vm-anti-affinity-rule",
datastore_cluster_id=datastore_cluster.id,
virtual_machine_ids=[[__item.id for __item in vm]])
package main
import (
"fmt"
"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
Name: pulumi.StringRef("dc-01"),
}, nil);
if err != nil {
return err
}
datastoreCluster, err := vsphere.LookupDatastoreCluster(ctx, &vsphere.LookupDatastoreClusterArgs{
Name: "datastore-cluster1",
DatacenterId: pulumi.StringRef(datacenter.Id),
}, nil);
if err != nil {
return err
}
cluster, err := vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{
Name: "cluster-01",
DatacenterId: pulumi.StringRef(datacenter.Id),
}, nil);
if err != nil {
return err
}
network, err := vsphere.GetNetwork(ctx, &vsphere.GetNetworkArgs{
Name: "network1",
DatacenterId: pulumi.StringRef(datacenter.Id),
}, nil);
if err != nil {
return err
}
var vm []*vsphere.VirtualMachine
for index := 0; index < 2; index++ {
key0 := index
val0 := index
__res, err := vsphere.NewVirtualMachine(ctx, fmt.Sprintf("vm-%v", key0), &vsphere.VirtualMachineArgs{
Name: pulumi.Sprintf("test-%v", val0),
ResourcePoolId: pulumi.String(cluster.ResourcePoolId),
DatastoreClusterId: pulumi.String(datastoreCluster.Id),
NumCpus: pulumi.Int(2),
Memory: pulumi.Int(2048),
GuestId: pulumi.String("otherLinux64Guest"),
NetworkInterfaces: vsphere.VirtualMachineNetworkInterfaceArray{
&vsphere.VirtualMachineNetworkInterfaceArgs{
NetworkId: pulumi.String(network.Id),
},
},
Disks: vsphere.VirtualMachineDiskArray{
&vsphere.VirtualMachineDiskArgs{
Label: pulumi.String("disk0"),
Size: pulumi.Int(20),
},
},
})
if err != nil {
return err
}
vm = append(vm, __res)
}
_, err = vsphere.NewDatastoreClusterVmAntiAffinityRule(ctx, "cluster_vm_anti_affinity_rule", &vsphere.DatastoreClusterVmAntiAffinityRuleArgs{
Name: pulumi.String("test-datastore-cluster-vm-anti-affinity-rule"),
DatastoreClusterId: pulumi.String(datastoreCluster.Id),
VirtualMachineIds: pulumi.StringArray{
pulumi.String(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:42,28-36)),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;
return await Deployment.RunAsync(() =>
{
var datacenter = VSphere.GetDatacenter.Invoke(new()
{
Name = "dc-01",
});
var datastoreCluster = VSphere.GetDatastoreCluster.Invoke(new()
{
Name = "datastore-cluster1",
DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
});
var cluster = VSphere.GetComputeCluster.Invoke(new()
{
Name = "cluster-01",
DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
});
var network = VSphere.GetNetwork.Invoke(new()
{
Name = "network1",
DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
});
var vm = new List<VSphere.VirtualMachine>();
for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
{
var range = new { Value = rangeIndex };
vm.Add(new VSphere.VirtualMachine($"vm-{range.Value}", new()
{
Name = $"test-{range.Value}",
ResourcePoolId = cluster.Apply(getComputeClusterResult => getComputeClusterResult.ResourcePoolId),
DatastoreClusterId = datastoreCluster.Apply(getDatastoreClusterResult => getDatastoreClusterResult.Id),
NumCpus = 2,
Memory = 2048,
GuestId = "otherLinux64Guest",
NetworkInterfaces = new[]
{
new VSphere.Inputs.VirtualMachineNetworkInterfaceArgs
{
NetworkId = network.Apply(getNetworkResult => getNetworkResult.Id),
},
},
Disks = new[]
{
new VSphere.Inputs.VirtualMachineDiskArgs
{
Label = "disk0",
Size = 20,
},
},
}));
}
var clusterVmAntiAffinityRule = new VSphere.DatastoreClusterVmAntiAffinityRule("cluster_vm_anti_affinity_rule", new()
{
Name = "test-datastore-cluster-vm-anti-affinity-rule",
DatastoreClusterId = datastoreCluster.Apply(getDatastoreClusterResult => getDatastoreClusterResult.Id),
VirtualMachineIds = new[]
{
vm.Select(__item => __item.Id).ToList(),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vsphere.VsphereFunctions;
import com.pulumi.vsphere.inputs.GetDatacenterArgs;
import com.pulumi.vsphere.inputs.GetDatastoreClusterArgs;
import com.pulumi.vsphere.inputs.GetComputeClusterArgs;
import com.pulumi.vsphere.inputs.GetNetworkArgs;
import com.pulumi.vsphere.VirtualMachine;
import com.pulumi.vsphere.VirtualMachineArgs;
import com.pulumi.vsphere.inputs.VirtualMachineNetworkInterfaceArgs;
import com.pulumi.vsphere.inputs.VirtualMachineDiskArgs;
import com.pulumi.vsphere.DatastoreClusterVmAntiAffinityRule;
import com.pulumi.vsphere.DatastoreClusterVmAntiAffinityRuleArgs;
import com.pulumi.codegen.internal.KeyedValue;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var datacenter = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
.name("dc-01")
.build());
final var datastoreCluster = VsphereFunctions.getDatastoreCluster(GetDatastoreClusterArgs.builder()
.name("datastore-cluster1")
.datacenterId(datacenter.applyValue(getDatacenterResult -> getDatacenterResult.id()))
.build());
final var cluster = VsphereFunctions.getComputeCluster(GetComputeClusterArgs.builder()
.name("cluster-01")
.datacenterId(datacenter.applyValue(getDatacenterResult -> getDatacenterResult.id()))
.build());
final var network = VsphereFunctions.getNetwork(GetNetworkArgs.builder()
.name("network1")
.datacenterId(datacenter.applyValue(getDatacenterResult -> getDatacenterResult.id()))
.build());
for (var i = 0; i < 2; i++) {
new VirtualMachine("vm-" + i, VirtualMachineArgs.builder()
.name(String.format("test-%s", range.value()))
.resourcePoolId(cluster.applyValue(getComputeClusterResult -> getComputeClusterResult.resourcePoolId()))
.datastoreClusterId(datastoreCluster.applyValue(getDatastoreClusterResult -> getDatastoreClusterResult.id()))
.numCpus(2)
.memory(2048)
.guestId("otherLinux64Guest")
.networkInterfaces(VirtualMachineNetworkInterfaceArgs.builder()
.networkId(network.applyValue(getNetworkResult -> getNetworkResult.id()))
.build())
.disks(VirtualMachineDiskArgs.builder()
.label("disk0")
.size(20)
.build())
.build());
}
var clusterVmAntiAffinityRule = new DatastoreClusterVmAntiAffinityRule("clusterVmAntiAffinityRule", DatastoreClusterVmAntiAffinityRuleArgs.builder()
.name("test-datastore-cluster-vm-anti-affinity-rule")
.datastoreClusterId(datastoreCluster.applyValue(getDatastoreClusterResult -> getDatastoreClusterResult.id()))
.virtualMachineIds(vm.stream().map(element -> element.id()).collect(toList()))
.build());
}
}
Coming soon!
Create DatastoreClusterVmAntiAffinityRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new DatastoreClusterVmAntiAffinityRule(name: string, args: DatastoreClusterVmAntiAffinityRuleArgs, opts?: CustomResourceOptions);
@overload
def DatastoreClusterVmAntiAffinityRule(resource_name: str,
args: DatastoreClusterVmAntiAffinityRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def DatastoreClusterVmAntiAffinityRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
datastore_cluster_id: Optional[str] = None,
virtual_machine_ids: Optional[Sequence[str]] = None,
enabled: Optional[bool] = None,
mandatory: Optional[bool] = None,
name: Optional[str] = None)
func NewDatastoreClusterVmAntiAffinityRule(ctx *Context, name string, args DatastoreClusterVmAntiAffinityRuleArgs, opts ...ResourceOption) (*DatastoreClusterVmAntiAffinityRule, error)
public DatastoreClusterVmAntiAffinityRule(string name, DatastoreClusterVmAntiAffinityRuleArgs args, CustomResourceOptions? opts = null)
public DatastoreClusterVmAntiAffinityRule(String name, DatastoreClusterVmAntiAffinityRuleArgs args)
public DatastoreClusterVmAntiAffinityRule(String name, DatastoreClusterVmAntiAffinityRuleArgs args, CustomResourceOptions options)
type: vsphere:DatastoreClusterVmAntiAffinityRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args DatastoreClusterVmAntiAffinityRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args DatastoreClusterVmAntiAffinityRuleArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args DatastoreClusterVmAntiAffinityRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DatastoreClusterVmAntiAffinityRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DatastoreClusterVmAntiAffinityRuleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var datastoreClusterVmAntiAffinityRuleResource = new VSphere.DatastoreClusterVmAntiAffinityRule("datastoreClusterVmAntiAffinityRuleResource", new()
{
DatastoreClusterId = "string",
VirtualMachineIds = new[]
{
"string",
},
Enabled = false,
Mandatory = false,
Name = "string",
});
example, err := vsphere.NewDatastoreClusterVmAntiAffinityRule(ctx, "datastoreClusterVmAntiAffinityRuleResource", &vsphere.DatastoreClusterVmAntiAffinityRuleArgs{
DatastoreClusterId: pulumi.String("string"),
VirtualMachineIds: pulumi.StringArray{
pulumi.String("string"),
},
Enabled: pulumi.Bool(false),
Mandatory: pulumi.Bool(false),
Name: pulumi.String("string"),
})
var datastoreClusterVmAntiAffinityRuleResource = new DatastoreClusterVmAntiAffinityRule("datastoreClusterVmAntiAffinityRuleResource", DatastoreClusterVmAntiAffinityRuleArgs.builder()
.datastoreClusterId("string")
.virtualMachineIds("string")
.enabled(false)
.mandatory(false)
.name("string")
.build());
datastore_cluster_vm_anti_affinity_rule_resource = vsphere.DatastoreClusterVmAntiAffinityRule("datastoreClusterVmAntiAffinityRuleResource",
datastore_cluster_id="string",
virtual_machine_ids=["string"],
enabled=False,
mandatory=False,
name="string")
const datastoreClusterVmAntiAffinityRuleResource = new vsphere.DatastoreClusterVmAntiAffinityRule("datastoreClusterVmAntiAffinityRuleResource", {
datastoreClusterId: "string",
virtualMachineIds: ["string"],
enabled: false,
mandatory: false,
name: "string",
});
type: vsphere:DatastoreClusterVmAntiAffinityRule
properties:
datastoreClusterId: string
enabled: false
mandatory: false
name: string
virtualMachineIds:
- string
DatastoreClusterVmAntiAffinityRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The DatastoreClusterVmAntiAffinityRule resource accepts the following input properties:
- Datastore
Cluster stringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- Virtual
Machine List<string>Ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.- Enabled bool
- Enable this rule in the cluster. Default:
true
. - Mandatory bool
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - Name string
- The name of the rule. This must be unique in the cluster.
- Datastore
Cluster stringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- Virtual
Machine []stringIds The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.- Enabled bool
- Enable this rule in the cluster. Default:
true
. - Mandatory bool
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - Name string
- The name of the rule. This must be unique in the cluster.
- datastore
Cluster StringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- virtual
Machine List<String>Ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.- enabled Boolean
- Enable this rule in the cluster. Default:
true
. - mandatory Boolean
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - name String
- The name of the rule. This must be unique in the cluster.
- datastore
Cluster stringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- virtual
Machine string[]Ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.- enabled boolean
- Enable this rule in the cluster. Default:
true
. - mandatory boolean
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - name string
- The name of the rule. This must be unique in the cluster.
- datastore_
cluster_ strid - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- virtual_
machine_ Sequence[str]ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.- enabled bool
- Enable this rule in the cluster. Default:
true
. - mandatory bool
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - name str
- The name of the rule. This must be unique in the cluster.
- datastore
Cluster StringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- virtual
Machine List<String>Ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.- enabled Boolean
- Enable this rule in the cluster. Default:
true
. - mandatory Boolean
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - name String
- The name of the rule. This must be unique in the cluster.
Outputs
All input properties are implicitly available as output properties. Additionally, the DatastoreClusterVmAntiAffinityRule resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing DatastoreClusterVmAntiAffinityRule Resource
Get an existing DatastoreClusterVmAntiAffinityRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: DatastoreClusterVmAntiAffinityRuleState, opts?: CustomResourceOptions): DatastoreClusterVmAntiAffinityRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
datastore_cluster_id: Optional[str] = None,
enabled: Optional[bool] = None,
mandatory: Optional[bool] = None,
name: Optional[str] = None,
virtual_machine_ids: Optional[Sequence[str]] = None) -> DatastoreClusterVmAntiAffinityRule
func GetDatastoreClusterVmAntiAffinityRule(ctx *Context, name string, id IDInput, state *DatastoreClusterVmAntiAffinityRuleState, opts ...ResourceOption) (*DatastoreClusterVmAntiAffinityRule, error)
public static DatastoreClusterVmAntiAffinityRule Get(string name, Input<string> id, DatastoreClusterVmAntiAffinityRuleState? state, CustomResourceOptions? opts = null)
public static DatastoreClusterVmAntiAffinityRule get(String name, Output<String> id, DatastoreClusterVmAntiAffinityRuleState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Datastore
Cluster stringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- Enabled bool
- Enable this rule in the cluster. Default:
true
. - Mandatory bool
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - Name string
- The name of the rule. This must be unique in the cluster.
- Virtual
Machine List<string>Ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.
- Datastore
Cluster stringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- Enabled bool
- Enable this rule in the cluster. Default:
true
. - Mandatory bool
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - Name string
- The name of the rule. This must be unique in the cluster.
- Virtual
Machine []stringIds The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.
- datastore
Cluster StringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- enabled Boolean
- Enable this rule in the cluster. Default:
true
. - mandatory Boolean
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - name String
- The name of the rule. This must be unique in the cluster.
- virtual
Machine List<String>Ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.
- datastore
Cluster stringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- enabled boolean
- Enable this rule in the cluster. Default:
true
. - mandatory boolean
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - name string
- The name of the rule. This must be unique in the cluster.
- virtual
Machine string[]Ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.
- datastore_
cluster_ strid - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- enabled bool
- Enable this rule in the cluster. Default:
true
. - mandatory bool
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - name str
- The name of the rule. This must be unique in the cluster.
- virtual_
machine_ Sequence[str]ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.
- datastore
Cluster StringId - The managed object reference ID of the datastore cluster to put the group in. Forces a new resource if changed.
- enabled Boolean
- Enable this rule in the cluster. Default:
true
. - mandatory Boolean
- When this value is
true
, prevents any virtual machine operations that may violate this rule. Default:false
. - name String
- The name of the rule. This must be unique in the cluster.
- virtual
Machine List<String>Ids The UUIDs of the virtual machines to run on different datastores from each other.
NOTE: The minimum length of
virtual_machine_ids
is 2.
Import
An existing rule can be imported into this resource by supplying
both the path to the cluster, and the name the rule. If the name or cluster is
not found, or if the rule is of a different type, an error will be returned. An
example is below:
$ pulumi import vsphere:index/datastoreClusterVmAntiAffinityRule:DatastoreClusterVmAntiAffinityRule cluster_vm_anti_affinity_rule \
‘{“compute_cluster_path”: “/dc1/datastore/cluster1”, \
“name”: “pulumi-test-datastore-cluster-vm-anti-affinity-rule”}’
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- vSphere pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vsphere
Terraform Provider.