1. Packages
  2. Packages
  3. Nutanix
  4. API Docs
  5. VmHostAffinityPolicyV2
Viewing docs for Nutanix v0.16.0
published on Tuesday, May 26, 2026 by Piers Karsenbarg
nutanix logo
Viewing docs for Nutanix v0.16.0
published on Tuesday, May 26, 2026 by Piers Karsenbarg

    Provides a resource to create, read, update, and delete VM-Host Affinity policies. VM-Host Affinity policies ensure that VMs in specific categories are placed on hosts in specified categories. This enables better control over VM placement for compliance, performance, or licensing requirements. For more information on VM-Host Affinity Policies, see the AHV Administration Guide.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as nutanix from "@pierskarsenbarg/nutanix";
    
    // Create VM categories
    const vmAffinityCategory = new nutanix.CategoryV2("vm_affinity_category", {
        key: "vm-host-affinity",
        value: "vm-affinity-group-1",
    });
    // Create host categories
    const hostAffinityCategory = new nutanix.CategoryV2("host_affinity_category", {
        key: "vm-host-affinity",
        value: "host-affinity-group-1",
    });
    // Create VM-Host Affinity policy
    const example = new nutanix.VmHostAffinityPolicyV2("example", {
        name: "vm-host-affinity-policy",
        description: "Policy to place VMs on specific hosts",
        vmCategories: [vmAffinityCategory.id],
        hostCategories: [hostAffinityCategory.id],
    });
    
    import pulumi
    import pulumi_nutanix as nutanix
    
    # Create VM categories
    vm_affinity_category = nutanix.CategoryV2("vm_affinity_category",
        key="vm-host-affinity",
        value="vm-affinity-group-1")
    # Create host categories
    host_affinity_category = nutanix.CategoryV2("host_affinity_category",
        key="vm-host-affinity",
        value="host-affinity-group-1")
    # Create VM-Host Affinity policy
    example = nutanix.VmHostAffinityPolicyV2("example",
        name="vm-host-affinity-policy",
        description="Policy to place VMs on specific hosts",
        vm_categories=[vm_affinity_category.id],
        host_categories=[host_affinity_category.id])
    
    package main
    
    import (
    	"github.com/pierskarsenbarg/pulumi-nutanix/sdk/go/nutanix"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create VM categories
    		vmAffinityCategory, err := nutanix.NewCategoryV2(ctx, "vm_affinity_category", &nutanix.CategoryV2Args{
    			Key:   pulumi.String("vm-host-affinity"),
    			Value: pulumi.String("vm-affinity-group-1"),
    		})
    		if err != nil {
    			return err
    		}
    		// Create host categories
    		hostAffinityCategory, err := nutanix.NewCategoryV2(ctx, "host_affinity_category", &nutanix.CategoryV2Args{
    			Key:   pulumi.String("vm-host-affinity"),
    			Value: pulumi.String("host-affinity-group-1"),
    		})
    		if err != nil {
    			return err
    		}
    		// Create VM-Host Affinity policy
    		_, err = nutanix.NewVmHostAffinityPolicyV2(ctx, "example", &nutanix.VmHostAffinityPolicyV2Args{
    			Name:        pulumi.String("vm-host-affinity-policy"),
    			Description: pulumi.String("Policy to place VMs on specific hosts"),
    			VmCategories: pulumi.StringArray{
    				vmAffinityCategory.ID(),
    			},
    			HostCategories: pulumi.StringArray{
    				hostAffinityCategory.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nutanix = PiersKarsenbarg.Nutanix;
    
    return await Deployment.RunAsync(() => 
    {
        // Create VM categories
        var vmAffinityCategory = new Nutanix.CategoryV2("vm_affinity_category", new()
        {
            Key = "vm-host-affinity",
            Value = "vm-affinity-group-1",
        });
    
        // Create host categories
        var hostAffinityCategory = new Nutanix.CategoryV2("host_affinity_category", new()
        {
            Key = "vm-host-affinity",
            Value = "host-affinity-group-1",
        });
    
        // Create VM-Host Affinity policy
        var example = new Nutanix.VmHostAffinityPolicyV2("example", new()
        {
            Name = "vm-host-affinity-policy",
            Description = "Policy to place VMs on specific hosts",
            VmCategories = new[]
            {
                vmAffinityCategory.Id,
            },
            HostCategories = new[]
            {
                hostAffinityCategory.Id,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nutanix.CategoryV2;
    import com.pulumi.nutanix.CategoryV2Args;
    import com.pulumi.nutanix.VmHostAffinityPolicyV2;
    import com.pulumi.nutanix.VmHostAffinityPolicyV2Args;
    import java.util.ArrayList;
    import java.util.Arrays;
    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) {
            // Create VM categories
            var vmAffinityCategory = new CategoryV2("vmAffinityCategory", CategoryV2Args.builder()
                .key("vm-host-affinity")
                .value("vm-affinity-group-1")
                .build());
    
            // Create host categories
            var hostAffinityCategory = new CategoryV2("hostAffinityCategory", CategoryV2Args.builder()
                .key("vm-host-affinity")
                .value("host-affinity-group-1")
                .build());
    
            // Create VM-Host Affinity policy
            var example = new VmHostAffinityPolicyV2("example", VmHostAffinityPolicyV2Args.builder()
                .name("vm-host-affinity-policy")
                .description("Policy to place VMs on specific hosts")
                .vmCategories(vmAffinityCategory.id())
                .hostCategories(hostAffinityCategory.id())
                .build());
    
        }
    }
    
    resources:
      # Create VM categories
      vmAffinityCategory:
        type: nutanix:CategoryV2
        name: vm_affinity_category
        properties:
          key: vm-host-affinity
          value: vm-affinity-group-1
      # Create host categories
      hostAffinityCategory:
        type: nutanix:CategoryV2
        name: host_affinity_category
        properties:
          key: vm-host-affinity
          value: host-affinity-group-1
      # Create VM-Host Affinity policy
      example:
        type: nutanix:VmHostAffinityPolicyV2
        properties:
          name: vm-host-affinity-policy
          description: Policy to place VMs on specific hosts
          vmCategories:
            - ${vmAffinityCategory.id}
          hostCategories:
            - ${hostAffinityCategory.id}
    
    pulumi {
      required_providers {
        nutanix = {
          source = "pulumi/nutanix"
        }
      }
    }
    
    # Create VM categories
    resource "nutanix_categoryv2" "vm_affinity_category" {
      key   = "vm-host-affinity"
      value = "vm-affinity-group-1"
    }
    # Create host categories
    resource "nutanix_categoryv2" "host_affinity_category" {
      key   = "vm-host-affinity"
      value = "host-affinity-group-1"
    }
    # Create VM-Host Affinity policy
    resource "nutanix_vmhostaffinitypolicyv2" "example" {
      name            = "vm-host-affinity-policy"
      description     = "Policy to place VMs on specific hosts"
      vm_categories   = [nutanix_categoryv2.vm_affinity_category.id]
      host_categories = [nutanix_categoryv2.host_affinity_category.id]
    }
    

    Example Import

    import * as pulumi from "@pulumi/pulumi";
    import * as nutanix from "@pierskarsenbarg/nutanix";
    
    // First, get the ext_id of the policy
    const policies = nutanix.getVmHostAffinityPoliciesV2({});
    // Create the configuration
    const imported = new nutanix.VmHostAffinityPolicyV2("imported", {});
    
    import pulumi
    import pulumi_nutanix as nutanix
    
    # First, get the ext_id of the policy
    policies = nutanix.get_vm_host_affinity_policies_v2()
    # Create the configuration
    imported = nutanix.VmHostAffinityPolicyV2("imported")
    
    package main
    
    import (
    	"github.com/pierskarsenbarg/pulumi-nutanix/sdk/go/nutanix"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// First, get the ext_id of the policy
    		_, err := nutanix.GetVmHostAffinityPoliciesV2(ctx, &nutanix.GetVmHostAffinityPoliciesV2Args{}, nil)
    		if err != nil {
    			return err
    		}
    		// Create the configuration
    		_, err = nutanix.NewVmHostAffinityPolicyV2(ctx, "imported", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nutanix = PiersKarsenbarg.Nutanix;
    
    return await Deployment.RunAsync(() => 
    {
        // First, get the ext_id of the policy
        var policies = Nutanix.GetVmHostAffinityPoliciesV2.Invoke();
    
        // Create the configuration
        var imported = new Nutanix.VmHostAffinityPolicyV2("imported");
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nutanix.NutanixFunctions;
    import com.pulumi.nutanix.inputs.GetVmHostAffinityPoliciesV2Args;
    import com.pulumi.nutanix.VmHostAffinityPolicyV2;
    import java.util.ArrayList;
    import java.util.Arrays;
    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) {
            // First, get the ext_id of the policy
            final var policies = NutanixFunctions.getVmHostAffinityPoliciesV2(GetVmHostAffinityPoliciesV2Args.builder()
                .build());
    
            // Create the configuration
            var imported = new VmHostAffinityPolicyV2("imported");
    
        }
    }
    
    resources:
      # Create the configuration
      imported:
        type: nutanix:VmHostAffinityPolicyV2
    variables:
      # First, get the ext_id of the policy
      policies:
        fn::invoke:
          function: nutanix:getVmHostAffinityPoliciesV2
          arguments: {}
    
    pulumi {
      required_providers {
        nutanix = {
          source = "pulumi/nutanix"
        }
      }
    }
    
    data "nutanix_getvmhostaffinitypoliciesv2" "policies" {
    }
    
    # Create the configuration
    resource "nutanix_vmhostaffinitypolicyv2" "imported" {
    }
    # First, get the ext_id of the policy
    

    See detailed information in Nutanix VM-Host Affinity Policies V4

    Create VmHostAffinityPolicyV2 Resource

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

    Constructor syntax

    new VmHostAffinityPolicyV2(name: string, args: VmHostAffinityPolicyV2Args, opts?: CustomResourceOptions);
    @overload
    def VmHostAffinityPolicyV2(resource_name: str,
                               args: VmHostAffinityPolicyV2Args,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def VmHostAffinityPolicyV2(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               host_categories: Optional[Sequence[str]] = None,
                               vm_categories: Optional[Sequence[str]] = None,
                               description: Optional[str] = None,
                               name: Optional[str] = None)
    func NewVmHostAffinityPolicyV2(ctx *Context, name string, args VmHostAffinityPolicyV2Args, opts ...ResourceOption) (*VmHostAffinityPolicyV2, error)
    public VmHostAffinityPolicyV2(string name, VmHostAffinityPolicyV2Args args, CustomResourceOptions? opts = null)
    public VmHostAffinityPolicyV2(String name, VmHostAffinityPolicyV2Args args)
    public VmHostAffinityPolicyV2(String name, VmHostAffinityPolicyV2Args args, CustomResourceOptions options)
    
    type: nutanix:VmHostAffinityPolicyV2
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "nutanix_vmhostaffinitypolicyv2" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args VmHostAffinityPolicyV2Args
    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 VmHostAffinityPolicyV2Args
    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 VmHostAffinityPolicyV2Args
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VmHostAffinityPolicyV2Args
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VmHostAffinityPolicyV2Args
    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 vmHostAffinityPolicyV2Resource = new Nutanix.VmHostAffinityPolicyV2("vmHostAffinityPolicyV2Resource", new()
    {
        HostCategories = new[]
        {
            "string",
        },
        VmCategories = new[]
        {
            "string",
        },
        Description = "string",
        Name = "string",
    });
    
    example, err := nutanix.NewVmHostAffinityPolicyV2(ctx, "vmHostAffinityPolicyV2Resource", &nutanix.VmHostAffinityPolicyV2Args{
    	HostCategories: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	VmCategories: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    resource "nutanix_vmhostaffinitypolicyv2" "vmHostAffinityPolicyV2Resource" {
      host_categories = ["string"]
      vm_categories   = ["string"]
      description     = "string"
      name            = "string"
    }
    
    var vmHostAffinityPolicyV2Resource = new VmHostAffinityPolicyV2("vmHostAffinityPolicyV2Resource", VmHostAffinityPolicyV2Args.builder()
        .hostCategories("string")
        .vmCategories("string")
        .description("string")
        .name("string")
        .build());
    
    vm_host_affinity_policy_v2_resource = nutanix.VmHostAffinityPolicyV2("vmHostAffinityPolicyV2Resource",
        host_categories=["string"],
        vm_categories=["string"],
        description="string",
        name="string")
    
    const vmHostAffinityPolicyV2Resource = new nutanix.VmHostAffinityPolicyV2("vmHostAffinityPolicyV2Resource", {
        hostCategories: ["string"],
        vmCategories: ["string"],
        description: "string",
        name: "string",
    });
    
    type: nutanix:VmHostAffinityPolicyV2
    properties:
        description: string
        hostCategories:
            - string
        name: string
        vmCategories:
            - string
    

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

    HostCategories List<string>
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    VmCategories List<string>
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    Description string
    A description of the VM-Host Affinity policy.
    Name string
    The name of the VM-Host Affinity policy.
    HostCategories []string
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    VmCategories []string
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    Description string
    A description of the VM-Host Affinity policy.
    Name string
    The name of the VM-Host Affinity policy.
    host_categories list(string)
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    vm_categories list(string)
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    description string
    A description of the VM-Host Affinity policy.
    name string
    The name of the VM-Host Affinity policy.
    hostCategories List<String>
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    vmCategories List<String>
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    description String
    A description of the VM-Host Affinity policy.
    name String
    The name of the VM-Host Affinity policy.
    hostCategories string[]
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    vmCategories string[]
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    description string
    A description of the VM-Host Affinity policy.
    name string
    The name of the VM-Host Affinity policy.
    host_categories Sequence[str]
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    vm_categories Sequence[str]
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    description str
    A description of the VM-Host Affinity policy.
    name str
    The name of the VM-Host Affinity policy.
    hostCategories List<String>
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    vmCategories List<String>
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    description String
    A description of the VM-Host Affinity policy.
    name String
    The name of the VM-Host Affinity policy.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VmHostAffinityPolicyV2 resource produces the following output properties:

    CreateTime string
    The timestamp when the policy was created.
    CreatedBy Dictionary<string, string>
    Information about the entity that created the policy.
    ExtId string
    The external identifier of the policy.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastUpdatedBy Dictionary<string, string>
    Information about the entity that last updated the policy.
    NumCompliantVms int
    Number of VMs which are compliant with the VM-host affinity policy.
    NumHosts int
    Number of hosts associated with the VM-host affinity policy.
    NumNonCompliantVms int
    Number of VMs which are not compliant with the VM-host affinity policy.
    NumVms int
    Number of VMs associated with the VM-host affinity policy.
    UpdateTime string
    The timestamp when the policy was last updated.
    CreateTime string
    The timestamp when the policy was created.
    CreatedBy map[string]string
    Information about the entity that created the policy.
    ExtId string
    The external identifier of the policy.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastUpdatedBy map[string]string
    Information about the entity that last updated the policy.
    NumCompliantVms int
    Number of VMs which are compliant with the VM-host affinity policy.
    NumHosts int
    Number of hosts associated with the VM-host affinity policy.
    NumNonCompliantVms int
    Number of VMs which are not compliant with the VM-host affinity policy.
    NumVms int
    Number of VMs associated with the VM-host affinity policy.
    UpdateTime string
    The timestamp when the policy was last updated.
    create_time string
    The timestamp when the policy was created.
    created_by map(string)
    Information about the entity that created the policy.
    ext_id string
    The external identifier of the policy.
    id string
    The provider-assigned unique ID for this managed resource.
    last_updated_by map(string)
    Information about the entity that last updated the policy.
    num_compliant_vms number
    Number of VMs which are compliant with the VM-host affinity policy.
    num_hosts number
    Number of hosts associated with the VM-host affinity policy.
    num_non_compliant_vms number
    Number of VMs which are not compliant with the VM-host affinity policy.
    num_vms number
    Number of VMs associated with the VM-host affinity policy.
    update_time string
    The timestamp when the policy was last updated.
    createTime String
    The timestamp when the policy was created.
    createdBy Map<String,String>
    Information about the entity that created the policy.
    extId String
    The external identifier of the policy.
    id String
    The provider-assigned unique ID for this managed resource.
    lastUpdatedBy Map<String,String>
    Information about the entity that last updated the policy.
    numCompliantVms Integer
    Number of VMs which are compliant with the VM-host affinity policy.
    numHosts Integer
    Number of hosts associated with the VM-host affinity policy.
    numNonCompliantVms Integer
    Number of VMs which are not compliant with the VM-host affinity policy.
    numVms Integer
    Number of VMs associated with the VM-host affinity policy.
    updateTime String
    The timestamp when the policy was last updated.
    createTime string
    The timestamp when the policy was created.
    createdBy {[key: string]: string}
    Information about the entity that created the policy.
    extId string
    The external identifier of the policy.
    id string
    The provider-assigned unique ID for this managed resource.
    lastUpdatedBy {[key: string]: string}
    Information about the entity that last updated the policy.
    numCompliantVms number
    Number of VMs which are compliant with the VM-host affinity policy.
    numHosts number
    Number of hosts associated with the VM-host affinity policy.
    numNonCompliantVms number
    Number of VMs which are not compliant with the VM-host affinity policy.
    numVms number
    Number of VMs associated with the VM-host affinity policy.
    updateTime string
    The timestamp when the policy was last updated.
    create_time str
    The timestamp when the policy was created.
    created_by Mapping[str, str]
    Information about the entity that created the policy.
    ext_id str
    The external identifier of the policy.
    id str
    The provider-assigned unique ID for this managed resource.
    last_updated_by Mapping[str, str]
    Information about the entity that last updated the policy.
    num_compliant_vms int
    Number of VMs which are compliant with the VM-host affinity policy.
    num_hosts int
    Number of hosts associated with the VM-host affinity policy.
    num_non_compliant_vms int
    Number of VMs which are not compliant with the VM-host affinity policy.
    num_vms int
    Number of VMs associated with the VM-host affinity policy.
    update_time str
    The timestamp when the policy was last updated.
    createTime String
    The timestamp when the policy was created.
    createdBy Map<String>
    Information about the entity that created the policy.
    extId String
    The external identifier of the policy.
    id String
    The provider-assigned unique ID for this managed resource.
    lastUpdatedBy Map<String>
    Information about the entity that last updated the policy.
    numCompliantVms Number
    Number of VMs which are compliant with the VM-host affinity policy.
    numHosts Number
    Number of hosts associated with the VM-host affinity policy.
    numNonCompliantVms Number
    Number of VMs which are not compliant with the VM-host affinity policy.
    numVms Number
    Number of VMs associated with the VM-host affinity policy.
    updateTime String
    The timestamp when the policy was last updated.

    Look up Existing VmHostAffinityPolicyV2 Resource

    Get an existing VmHostAffinityPolicyV2 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?: VmHostAffinityPolicyV2State, opts?: CustomResourceOptions): VmHostAffinityPolicyV2
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            create_time: Optional[str] = None,
            created_by: Optional[Mapping[str, str]] = None,
            description: Optional[str] = None,
            ext_id: Optional[str] = None,
            host_categories: Optional[Sequence[str]] = None,
            last_updated_by: Optional[Mapping[str, str]] = None,
            name: Optional[str] = None,
            num_compliant_vms: Optional[int] = None,
            num_hosts: Optional[int] = None,
            num_non_compliant_vms: Optional[int] = None,
            num_vms: Optional[int] = None,
            update_time: Optional[str] = None,
            vm_categories: Optional[Sequence[str]] = None) -> VmHostAffinityPolicyV2
    func GetVmHostAffinityPolicyV2(ctx *Context, name string, id IDInput, state *VmHostAffinityPolicyV2State, opts ...ResourceOption) (*VmHostAffinityPolicyV2, error)
    public static VmHostAffinityPolicyV2 Get(string name, Input<string> id, VmHostAffinityPolicyV2State? state, CustomResourceOptions? opts = null)
    public static VmHostAffinityPolicyV2 get(String name, Output<String> id, VmHostAffinityPolicyV2State state, CustomResourceOptions options)
    resources:  _:    type: nutanix:VmHostAffinityPolicyV2    get:      id: ${id}
    import {
      to = nutanix_vmhostaffinitypolicyv2.example
      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:
    CreateTime string
    The timestamp when the policy was created.
    CreatedBy Dictionary<string, string>
    Information about the entity that created the policy.
    Description string
    A description of the VM-Host Affinity policy.
    ExtId string
    The external identifier of the policy.
    HostCategories List<string>
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    LastUpdatedBy Dictionary<string, string>
    Information about the entity that last updated the policy.
    Name string
    The name of the VM-Host Affinity policy.
    NumCompliantVms int
    Number of VMs which are compliant with the VM-host affinity policy.
    NumHosts int
    Number of hosts associated with the VM-host affinity policy.
    NumNonCompliantVms int
    Number of VMs which are not compliant with the VM-host affinity policy.
    NumVms int
    Number of VMs associated with the VM-host affinity policy.
    UpdateTime string
    The timestamp when the policy was last updated.
    VmCategories List<string>
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    CreateTime string
    The timestamp when the policy was created.
    CreatedBy map[string]string
    Information about the entity that created the policy.
    Description string
    A description of the VM-Host Affinity policy.
    ExtId string
    The external identifier of the policy.
    HostCategories []string
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    LastUpdatedBy map[string]string
    Information about the entity that last updated the policy.
    Name string
    The name of the VM-Host Affinity policy.
    NumCompliantVms int
    Number of VMs which are compliant with the VM-host affinity policy.
    NumHosts int
    Number of hosts associated with the VM-host affinity policy.
    NumNonCompliantVms int
    Number of VMs which are not compliant with the VM-host affinity policy.
    NumVms int
    Number of VMs associated with the VM-host affinity policy.
    UpdateTime string
    The timestamp when the policy was last updated.
    VmCategories []string
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    create_time string
    The timestamp when the policy was created.
    created_by map(string)
    Information about the entity that created the policy.
    description string
    A description of the VM-Host Affinity policy.
    ext_id string
    The external identifier of the policy.
    host_categories list(string)
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    last_updated_by map(string)
    Information about the entity that last updated the policy.
    name string
    The name of the VM-Host Affinity policy.
    num_compliant_vms number
    Number of VMs which are compliant with the VM-host affinity policy.
    num_hosts number
    Number of hosts associated with the VM-host affinity policy.
    num_non_compliant_vms number
    Number of VMs which are not compliant with the VM-host affinity policy.
    num_vms number
    Number of VMs associated with the VM-host affinity policy.
    update_time string
    The timestamp when the policy was last updated.
    vm_categories list(string)
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    createTime String
    The timestamp when the policy was created.
    createdBy Map<String,String>
    Information about the entity that created the policy.
    description String
    A description of the VM-Host Affinity policy.
    extId String
    The external identifier of the policy.
    hostCategories List<String>
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    lastUpdatedBy Map<String,String>
    Information about the entity that last updated the policy.
    name String
    The name of the VM-Host Affinity policy.
    numCompliantVms Integer
    Number of VMs which are compliant with the VM-host affinity policy.
    numHosts Integer
    Number of hosts associated with the VM-host affinity policy.
    numNonCompliantVms Integer
    Number of VMs which are not compliant with the VM-host affinity policy.
    numVms Integer
    Number of VMs associated with the VM-host affinity policy.
    updateTime String
    The timestamp when the policy was last updated.
    vmCategories List<String>
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    createTime string
    The timestamp when the policy was created.
    createdBy {[key: string]: string}
    Information about the entity that created the policy.
    description string
    A description of the VM-Host Affinity policy.
    extId string
    The external identifier of the policy.
    hostCategories string[]
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    lastUpdatedBy {[key: string]: string}
    Information about the entity that last updated the policy.
    name string
    The name of the VM-Host Affinity policy.
    numCompliantVms number
    Number of VMs which are compliant with the VM-host affinity policy.
    numHosts number
    Number of hosts associated with the VM-host affinity policy.
    numNonCompliantVms number
    Number of VMs which are not compliant with the VM-host affinity policy.
    numVms number
    Number of VMs associated with the VM-host affinity policy.
    updateTime string
    The timestamp when the policy was last updated.
    vmCategories string[]
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    create_time str
    The timestamp when the policy was created.
    created_by Mapping[str, str]
    Information about the entity that created the policy.
    description str
    A description of the VM-Host Affinity policy.
    ext_id str
    The external identifier of the policy.
    host_categories Sequence[str]
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    last_updated_by Mapping[str, str]
    Information about the entity that last updated the policy.
    name str
    The name of the VM-Host Affinity policy.
    num_compliant_vms int
    Number of VMs which are compliant with the VM-host affinity policy.
    num_hosts int
    Number of hosts associated with the VM-host affinity policy.
    num_non_compliant_vms int
    Number of VMs which are not compliant with the VM-host affinity policy.
    num_vms int
    Number of VMs associated with the VM-host affinity policy.
    update_time str
    The timestamp when the policy was last updated.
    vm_categories Sequence[str]
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.
    createTime String
    The timestamp when the policy was created.
    createdBy Map<String>
    Information about the entity that created the policy.
    description String
    A description of the VM-Host Affinity policy.
    extId String
    The external identifier of the policy.
    hostCategories List<String>
    List of host category external IDs that define where the VMs can be placed. Hosts with these categories will be used for VM placement.
    lastUpdatedBy Map<String>
    Information about the entity that last updated the policy.
    name String
    The name of the VM-Host Affinity policy.
    numCompliantVms Number
    Number of VMs which are compliant with the VM-host affinity policy.
    numHosts Number
    Number of hosts associated with the VM-host affinity policy.
    numNonCompliantVms Number
    Number of VMs which are not compliant with the VM-host affinity policy.
    numVms Number
    Number of VMs associated with the VM-host affinity policy.
    updateTime String
    The timestamp when the policy was last updated.
    vmCategories List<String>
    List of VM category external IDs that this policy applies to. VMs with these categories will be subject to the affinity placement rules.

    Package Details

    Repository
    nutanix pierskarsenbarg/pulumi-nutanix
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the nutanix Terraform Provider.
    nutanix logo
    Viewing docs for Nutanix v0.16.0
    published on Tuesday, May 26, 2026 by Piers Karsenbarg

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial