1. Packages
  2. Vcd Provider
  3. API Docs
  4. VmAffinityRule
vcd 3.14.1 published on Monday, Apr 14, 2025 by vmware

vcd.VmAffinityRule

Explore with Pulumi AI

vcd logo
vcd 3.14.1 published on Monday, Apr 14, 2025 by vmware

    Create VmAffinityRule Resource

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

    Constructor syntax

    new VmAffinityRule(name: string, args: VmAffinityRuleArgs, opts?: CustomResourceOptions);
    @overload
    def VmAffinityRule(resource_name: str,
                       args: VmAffinityRuleArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def VmAffinityRule(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       polarity: Optional[str] = None,
                       vm_ids: Optional[Sequence[str]] = None,
                       enabled: Optional[bool] = None,
                       name: Optional[str] = None,
                       org: Optional[str] = None,
                       required: Optional[bool] = None,
                       vdc: Optional[str] = None,
                       vm_affinity_rule_id: Optional[str] = None)
    func NewVmAffinityRule(ctx *Context, name string, args VmAffinityRuleArgs, opts ...ResourceOption) (*VmAffinityRule, error)
    public VmAffinityRule(string name, VmAffinityRuleArgs args, CustomResourceOptions? opts = null)
    public VmAffinityRule(String name, VmAffinityRuleArgs args)
    public VmAffinityRule(String name, VmAffinityRuleArgs args, CustomResourceOptions options)
    
    type: vcd:VmAffinityRule
    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 VmAffinityRuleArgs
    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 VmAffinityRuleArgs
    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 VmAffinityRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VmAffinityRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VmAffinityRuleArgs
    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 vmAffinityRuleResource = new Vcd.VmAffinityRule("vmAffinityRuleResource", new()
    {
        Polarity = "string",
        VmIds = new[]
        {
            "string",
        },
        Enabled = false,
        Name = "string",
        Org = "string",
        Required = false,
        Vdc = "string",
        VmAffinityRuleId = "string",
    });
    
    example, err := vcd.NewVmAffinityRule(ctx, "vmAffinityRuleResource", &vcd.VmAffinityRuleArgs{
    	Polarity: pulumi.String("string"),
    	VmIds: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Enabled:          pulumi.Bool(false),
    	Name:             pulumi.String("string"),
    	Org:              pulumi.String("string"),
    	Required:         pulumi.Bool(false),
    	Vdc:              pulumi.String("string"),
    	VmAffinityRuleId: pulumi.String("string"),
    })
    
    var vmAffinityRuleResource = new VmAffinityRule("vmAffinityRuleResource", VmAffinityRuleArgs.builder()
        .polarity("string")
        .vmIds("string")
        .enabled(false)
        .name("string")
        .org("string")
        .required(false)
        .vdc("string")
        .vmAffinityRuleId("string")
        .build());
    
    vm_affinity_rule_resource = vcd.VmAffinityRule("vmAffinityRuleResource",
        polarity="string",
        vm_ids=["string"],
        enabled=False,
        name="string",
        org="string",
        required=False,
        vdc="string",
        vm_affinity_rule_id="string")
    
    const vmAffinityRuleResource = new vcd.VmAffinityRule("vmAffinityRuleResource", {
        polarity: "string",
        vmIds: ["string"],
        enabled: false,
        name: "string",
        org: "string",
        required: false,
        vdc: "string",
        vmAffinityRuleId: "string",
    });
    
    type: vcd:VmAffinityRule
    properties:
        enabled: false
        name: string
        org: string
        polarity: string
        required: false
        vdc: string
        vmAffinityRuleId: string
        vmIds:
            - string
    

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

    Polarity string
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    VmIds List<string>
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    Enabled bool
    True if this affinity rule is enabled. The default is true
    Name string
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    Org string
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    Required bool
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    Vdc string
    The name of VDC to use, optional if defined at provider level
    VmAffinityRuleId string
    Polarity string
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    VmIds []string
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    Enabled bool
    True if this affinity rule is enabled. The default is true
    Name string
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    Org string
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    Required bool
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    Vdc string
    The name of VDC to use, optional if defined at provider level
    VmAffinityRuleId string
    polarity String
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    vmIds List<String>
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    enabled Boolean
    True if this affinity rule is enabled. The default is true
    name String
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    org String
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    required Boolean
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    vdc String
    The name of VDC to use, optional if defined at provider level
    vmAffinityRuleId String
    polarity string
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    vmIds string[]
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    enabled boolean
    True if this affinity rule is enabled. The default is true
    name string
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    org string
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    required boolean
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    vdc string
    The name of VDC to use, optional if defined at provider level
    vmAffinityRuleId string
    polarity str
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    vm_ids Sequence[str]
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    enabled bool
    True if this affinity rule is enabled. The default is true
    name str
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    org str
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    required bool
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    vdc str
    The name of VDC to use, optional if defined at provider level
    vm_affinity_rule_id str
    polarity String
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    vmIds List<String>
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    enabled Boolean
    True if this affinity rule is enabled. The default is true
    name String
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    org String
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    required Boolean
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    vdc String
    The name of VDC to use, optional if defined at provider level
    vmAffinityRuleId String

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VmAffinityRule 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 VmAffinityRule Resource

    Get an existing VmAffinityRule 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?: VmAffinityRuleState, opts?: CustomResourceOptions): VmAffinityRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            enabled: Optional[bool] = None,
            name: Optional[str] = None,
            org: Optional[str] = None,
            polarity: Optional[str] = None,
            required: Optional[bool] = None,
            vdc: Optional[str] = None,
            vm_affinity_rule_id: Optional[str] = None,
            vm_ids: Optional[Sequence[str]] = None) -> VmAffinityRule
    func GetVmAffinityRule(ctx *Context, name string, id IDInput, state *VmAffinityRuleState, opts ...ResourceOption) (*VmAffinityRule, error)
    public static VmAffinityRule Get(string name, Input<string> id, VmAffinityRuleState? state, CustomResourceOptions? opts = null)
    public static VmAffinityRule get(String name, Output<String> id, VmAffinityRuleState state, CustomResourceOptions options)
    resources:  _:    type: vcd:VmAffinityRule    get:      id: ${id}
    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:
    Enabled bool
    True if this affinity rule is enabled. The default is true
    Name string
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    Org string
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    Polarity string
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    Required bool
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    Vdc string
    The name of VDC to use, optional if defined at provider level
    VmAffinityRuleId string
    VmIds List<string>
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    Enabled bool
    True if this affinity rule is enabled. The default is true
    Name string
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    Org string
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    Polarity string
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    Required bool
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    Vdc string
    The name of VDC to use, optional if defined at provider level
    VmAffinityRuleId string
    VmIds []string
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    enabled Boolean
    True if this affinity rule is enabled. The default is true
    name String
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    org String
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    polarity String
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    required Boolean
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    vdc String
    The name of VDC to use, optional if defined at provider level
    vmAffinityRuleId String
    vmIds List<String>
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    enabled boolean
    True if this affinity rule is enabled. The default is true
    name string
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    org string
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    polarity string
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    required boolean
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    vdc string
    The name of VDC to use, optional if defined at provider level
    vmAffinityRuleId string
    vmIds string[]
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    enabled bool
    True if this affinity rule is enabled. The default is true
    name str
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    org str
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    polarity str
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    required bool
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    vdc str
    The name of VDC to use, optional if defined at provider level
    vm_affinity_rule_id str
    vm_ids Sequence[str]
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.
    enabled Boolean
    True if this affinity rule is enabled. The default is true
    name String
    The name of VM affinity rule. Duplicates are allowed, although the name can be used to retrieve the rule (as data source or when importing) only if it is unique.
    org String
    The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations
    polarity String
    One of Affinity or Anti-Affinity. This property cannot be changed. Once created, if we need to change polarity, we need to remove the rule and create a new one.
    required Boolean
    True if this affinity rule is required. When a rule is mandatory, a host failover will not power on the VM if doing so would violate the rule. The default is true
    vdc String
    The name of VDC to use, optional if defined at provider level
    vmAffinityRuleId String
    vmIds List<String>
    A set of virtual machine IDs that compose this rule. At least 2 IDs must be provided.

    Package Details

    Repository
    vcd vmware/terraform-provider-vcd
    License
    Notes
    This Pulumi package is based on the vcd Terraform Provider.
    vcd logo
    vcd 3.14.1 published on Monday, Apr 14, 2025 by vmware