Show / Hide Table of Contents

Class ComputeClusterVmDependencyRule

The vsphere..ComputeClusterVmDependencyRule resource can be used to manage VM dependency rules in a cluster, either created by the vsphere..ComputeCluster resource or looked up by the vsphere..ComputeCluster data source.

A virtual machine dependency rule applies to vSphere HA, and allows user-defined startup orders for virtual machines in the case of host failure. Virtual machines are supplied via groups, which can be managed via the vsphere..ComputeClusterVmGroup resource.

NOTE: This resource requires vCenter and is not available on direct ESXi connections.

Example Usage

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
public MyStack()
{
    var dc = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
    {
        Name = "dc1",
    }));
    var datastore = dc.Apply(dc => Output.Create(VSphere.GetDatastore.InvokeAsync(new VSphere.GetDatastoreArgs
    {
        DatacenterId = dc.Id,
        Name = "datastore1",
    })));
    var cluster = dc.Apply(dc => Output.Create(VSphere.GetComputeCluster.InvokeAsync(new VSphere.GetComputeClusterArgs
    {
        DatacenterId = dc.Id,
        Name = "cluster1",
    })));
    var network = dc.Apply(dc => Output.Create(VSphere.GetNetwork.InvokeAsync(new VSphere.GetNetworkArgs
    {
        DatacenterId = dc.Id,
        Name = "network1",
    })));
    var vm1 = new VSphere.VirtualMachine("vm1", new VSphere.VirtualMachineArgs
    {
        DatastoreId = datastore.Apply(datastore => datastore.Id),
        Disks = 
        {
            new VSphere.Inputs.VirtualMachineDiskArgs
            {
                Label = "disk0",
                Size = 20,
            },
        },
        GuestId = "other3xLinux64Guest",
        Memory = 2048,
        NetworkInterfaces = 
        {
            new VSphere.Inputs.VirtualMachineNetworkInterfaceArgs
            {
                NetworkId = network.Apply(network => network.Id),
            },
        },
        NumCpus = 2,
        ResourcePoolId = cluster.Apply(cluster => cluster.ResourcePoolId),
    });
    var vm2 = new VSphere.VirtualMachine("vm2", new VSphere.VirtualMachineArgs
    {
        DatastoreId = datastore.Apply(datastore => datastore.Id),
        Disks = 
        {
            new VSphere.Inputs.VirtualMachineDiskArgs
            {
                Label = "disk0",
                Size = 20,
            },
        },
        GuestId = "other3xLinux64Guest",
        Memory = 2048,
        NetworkInterfaces = 
        {
            new VSphere.Inputs.VirtualMachineNetworkInterfaceArgs
            {
                NetworkId = network.Apply(network => network.Id),
            },
        },
        NumCpus = 2,
        ResourcePoolId = cluster.Apply(cluster => cluster.ResourcePoolId),
    });
    var clusterVmGroup1 = new VSphere.ComputeClusterVmGroup("clusterVmGroup1", new VSphere.ComputeClusterVmGroupArgs
    {
        ComputeClusterId = cluster.Apply(cluster => cluster.Id),
        VirtualMachineIds = 
        {
            vm1.Id,
        },
    });
    var clusterVmGroup2 = new VSphere.ComputeClusterVmGroup("clusterVmGroup2", new VSphere.ComputeClusterVmGroupArgs
    {
        ComputeClusterId = cluster.Apply(cluster => cluster.Id),
        VirtualMachineIds = 
        {
            vm2.Id,
        },
    });
    var clusterVmDependencyRule = new VSphere.ComputeClusterVmDependencyRule("clusterVmDependencyRule", new VSphere.ComputeClusterVmDependencyRuleArgs
    {
        ComputeClusterId = cluster.Apply(cluster => cluster.Id),
        DependencyVmGroupName = clusterVmGroup1.Name,
        VmGroupName = clusterVmGroup2.Name,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
ComputeClusterVmDependencyRule
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.VSphere
Assembly: Pulumi.VSphere.dll
Syntax
public class ComputeClusterVmDependencyRule : CustomResource

Constructors

View Source

ComputeClusterVmDependencyRule(String, ComputeClusterVmDependencyRuleArgs, CustomResourceOptions)

Create a ComputeClusterVmDependencyRule resource with the given unique name, arguments, and options.

Declaration
public ComputeClusterVmDependencyRule(string name, ComputeClusterVmDependencyRuleArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

ComputeClusterVmDependencyRuleArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

ComputeClusterId

The managed object reference ID of the cluster to put the group in. Forces a new resource if changed.

Declaration
public Output<string> ComputeClusterId { get; }
Property Value
Type Description
Output<System.String>
View Source

DependencyVmGroupName

The name of the VM group that this rule depends on. The VMs defined in the group specified by vm_group_name will not be started until the VMs in this group are started.

Declaration
public Output<string> DependencyVmGroupName { get; }
Property Value
Type Description
Output<System.String>
View Source

Enabled

Enable this rule in the cluster. Default: true.

Declaration
public Output<bool?> Enabled { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Mandatory

When this value is true, prevents any virtual machine operations that may violate this rule. Default: false.

Declaration
public Output<bool?> Mandatory { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Name

The name of the rule. This must be unique in the cluster.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

VmGroupName

The name of the VM group that is the subject of this rule. The VMs defined in this group will not be started until the VMs in the group specified by dependency_vm_group_name are started.

Declaration
public Output<string> VmGroupName { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, ComputeClusterVmDependencyRuleState, CustomResourceOptions)

Get an existing ComputeClusterVmDependencyRule resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static ComputeClusterVmDependencyRule Get(string name, Input<string> id, ComputeClusterVmDependencyRuleState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

ComputeClusterVmDependencyRuleState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
ComputeClusterVmDependencyRule
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.