1. Packages
  2. Vsphere Provider
  3. API Docs
  4. ComputeClusterVmHostRule
vSphere v4.12.1 published on Tuesday, Oct 22, 2024 by Pulumi

vsphere.ComputeClusterVmHostRule

Explore with Pulumi AI

vsphere logo
vSphere v4.12.1 published on Tuesday, Oct 22, 2024 by Pulumi

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

    This resource can create both affinity rules, where virtual machines run on specified hosts, or anti-affinity rules, where virtual machines run on hosts outside of the ones specified in the rule. Virtual machines and hosts are supplied via groups, which can be managed via the vsphere.ComputeClusterVmGroup and vsphere.ComputeClusterHostGroup resources.

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

    Create ComputeClusterVmHostRule Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ComputeClusterVmHostRule(name: string, args: ComputeClusterVmHostRuleArgs, opts?: CustomResourceOptions);
    @overload
    def ComputeClusterVmHostRule(resource_name: str,
                                 args: ComputeClusterVmHostRuleArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def ComputeClusterVmHostRule(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 compute_cluster_id: Optional[str] = None,
                                 vm_group_name: Optional[str] = None,
                                 affinity_host_group_name: Optional[str] = None,
                                 anti_affinity_host_group_name: Optional[str] = None,
                                 enabled: Optional[bool] = None,
                                 mandatory: Optional[bool] = None,
                                 name: Optional[str] = None)
    func NewComputeClusterVmHostRule(ctx *Context, name string, args ComputeClusterVmHostRuleArgs, opts ...ResourceOption) (*ComputeClusterVmHostRule, error)
    public ComputeClusterVmHostRule(string name, ComputeClusterVmHostRuleArgs args, CustomResourceOptions? opts = null)
    public ComputeClusterVmHostRule(String name, ComputeClusterVmHostRuleArgs args)
    public ComputeClusterVmHostRule(String name, ComputeClusterVmHostRuleArgs args, CustomResourceOptions options)
    
    type: vsphere:ComputeClusterVmHostRule
    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 ComputeClusterVmHostRuleArgs
    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 ComputeClusterVmHostRuleArgs
    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 ComputeClusterVmHostRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ComputeClusterVmHostRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ComputeClusterVmHostRuleArgs
    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 computeClusterVmHostRuleResource = new VSphere.ComputeClusterVmHostRule("computeClusterVmHostRuleResource", new()
    {
        ComputeClusterId = "string",
        VmGroupName = "string",
        AffinityHostGroupName = "string",
        AntiAffinityHostGroupName = "string",
        Enabled = false,
        Mandatory = false,
        Name = "string",
    });
    
    example, err := vsphere.NewComputeClusterVmHostRule(ctx, "computeClusterVmHostRuleResource", &vsphere.ComputeClusterVmHostRuleArgs{
    	ComputeClusterId:          pulumi.String("string"),
    	VmGroupName:               pulumi.String("string"),
    	AffinityHostGroupName:     pulumi.String("string"),
    	AntiAffinityHostGroupName: pulumi.String("string"),
    	Enabled:                   pulumi.Bool(false),
    	Mandatory:                 pulumi.Bool(false),
    	Name:                      pulumi.String("string"),
    })
    
    var computeClusterVmHostRuleResource = new ComputeClusterVmHostRule("computeClusterVmHostRuleResource", ComputeClusterVmHostRuleArgs.builder()
        .computeClusterId("string")
        .vmGroupName("string")
        .affinityHostGroupName("string")
        .antiAffinityHostGroupName("string")
        .enabled(false)
        .mandatory(false)
        .name("string")
        .build());
    
    compute_cluster_vm_host_rule_resource = vsphere.ComputeClusterVmHostRule("computeClusterVmHostRuleResource",
        compute_cluster_id="string",
        vm_group_name="string",
        affinity_host_group_name="string",
        anti_affinity_host_group_name="string",
        enabled=False,
        mandatory=False,
        name="string")
    
    const computeClusterVmHostRuleResource = new vsphere.ComputeClusterVmHostRule("computeClusterVmHostRuleResource", {
        computeClusterId: "string",
        vmGroupName: "string",
        affinityHostGroupName: "string",
        antiAffinityHostGroupName: "string",
        enabled: false,
        mandatory: false,
        name: "string",
    });
    
    type: vsphere:ComputeClusterVmHostRule
    properties:
        affinityHostGroupName: string
        antiAffinityHostGroupName: string
        computeClusterId: string
        enabled: false
        mandatory: false
        name: string
        vmGroupName: string
    

    ComputeClusterVmHostRule 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 ComputeClusterVmHostRule resource accepts the following input properties:

    ComputeClusterId string
    The managed object reference ID of the cluster to put the group in. Forces a new resource if changed.
    VmGroupName string
    The name of the virtual machine group to use with this rule.
    AffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    AntiAffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    Name string
    The name of the rule. This must be unique in the cluster.
    ComputeClusterId string
    The managed object reference ID of the cluster to put the group in. Forces a new resource if changed.
    VmGroupName string
    The name of the virtual machine group to use with this rule.
    AffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    AntiAffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    Name string
    The name of the rule. This must be unique in the cluster.
    computeClusterId String
    The managed object reference ID of the cluster to put the group in. Forces a new resource if changed.
    vmGroupName String
    The name of the virtual machine group to use with this rule.
    affinityHostGroupName String
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    antiAffinityHostGroupName String
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    name String
    The name of the rule. This must be unique in the cluster.
    computeClusterId string
    The managed object reference ID of the cluster to put the group in. Forces a new resource if changed.
    vmGroupName string
    The name of the virtual machine group to use with this rule.
    affinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    antiAffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    name string
    The name of the rule. This must be unique in the cluster.
    compute_cluster_id str
    The managed object reference ID of the cluster to put the group in. Forces a new resource if changed.
    vm_group_name str
    The name of the virtual machine group to use with this rule.
    affinity_host_group_name str
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    anti_affinity_host_group_name str
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    name str
    The name of the rule. This must be unique in the cluster.
    computeClusterId String
    The managed object reference ID of the cluster to put the group in. Forces a new resource if changed.
    vmGroupName String
    The name of the virtual machine group to use with this rule.
    affinityHostGroupName String
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    antiAffinityHostGroupName String
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    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 ComputeClusterVmHostRule 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 ComputeClusterVmHostRule Resource

    Get an existing ComputeClusterVmHostRule 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?: ComputeClusterVmHostRuleState, opts?: CustomResourceOptions): ComputeClusterVmHostRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            affinity_host_group_name: Optional[str] = None,
            anti_affinity_host_group_name: Optional[str] = None,
            compute_cluster_id: Optional[str] = None,
            enabled: Optional[bool] = None,
            mandatory: Optional[bool] = None,
            name: Optional[str] = None,
            vm_group_name: Optional[str] = None) -> ComputeClusterVmHostRule
    func GetComputeClusterVmHostRule(ctx *Context, name string, id IDInput, state *ComputeClusterVmHostRuleState, opts ...ResourceOption) (*ComputeClusterVmHostRule, error)
    public static ComputeClusterVmHostRule Get(string name, Input<string> id, ComputeClusterVmHostRuleState? state, CustomResourceOptions? opts = null)
    public static ComputeClusterVmHostRule get(String name, Output<String> id, ComputeClusterVmHostRuleState 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.
    The following state arguments are supported:
    AffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    AntiAffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    ComputeClusterId string
    The managed object reference ID of the 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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    Name string
    The name of the rule. This must be unique in the cluster.
    VmGroupName string
    The name of the virtual machine group to use with this rule.
    AffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    AntiAffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    ComputeClusterId string
    The managed object reference ID of the 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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    Name string
    The name of the rule. This must be unique in the cluster.
    VmGroupName string
    The name of the virtual machine group to use with this rule.
    affinityHostGroupName String
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    antiAffinityHostGroupName String
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    computeClusterId String
    The managed object reference ID of the 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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    name String
    The name of the rule. This must be unique in the cluster.
    vmGroupName String
    The name of the virtual machine group to use with this rule.
    affinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    antiAffinityHostGroupName string
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    computeClusterId string
    The managed object reference ID of the 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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    name string
    The name of the rule. This must be unique in the cluster.
    vmGroupName string
    The name of the virtual machine group to use with this rule.
    affinity_host_group_name str
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    anti_affinity_host_group_name str
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    compute_cluster_id str
    The managed object reference ID of the 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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    name str
    The name of the rule. This must be unique in the cluster.
    vm_group_name str
    The name of the virtual machine group to use with this rule.
    affinityHostGroupName String
    When this field is used, the virtual machines defined in vm_group_name will be run on the hosts defined in this host group.
    antiAffinityHostGroupName String
    When this field is used, the virtual machines defined in vm_group_name will not be run on the hosts defined in this host group.
    computeClusterId String
    The managed object reference ID of the 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.

    NOTE: One of affinity_host_group_name or anti_affinity_host_group_name must be defined, but not both.

    NOTE: The namespace for rule names on this resource (defined by the name argument) is shared with all rules in the cluster - consider this when naming your rules.

    name String
    The name of the rule. This must be unique in the cluster.
    vmGroupName String
    The name of the virtual machine group to use with this rule.

    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/computeClusterVmHostRule:ComputeClusterVmHostRule cluster_vm_host_rule \
    

    ‘{“compute_cluster_path”: “/dc1/host/cluster1”, \

    “name”: “pulumi-test-cluster-vm-host-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.
    vsphere logo
    vSphere v4.12.1 published on Tuesday, Oct 22, 2024 by Pulumi