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

vsphere.Host

Explore with Pulumi AI

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

    Provides a VMware vSphere host resource. This represents an ESXi host that can be used either as a member of a cluster or as a standalone host.

    Example Usage

    Create a standalone host

    import * as pulumi from "@pulumi/pulumi";
    import * as vsphere from "@pulumi/vsphere";
    
    const datacenter = vsphere.getDatacenter({
        name: "dc-01",
    });
    const thumbprint = vsphere.getHostThumbprint({
        address: "esxi-01.example.com",
        insecure: true,
    });
    const esx_01 = new vsphere.Host("esx-01", {
        hostname: "esxi-01.example.com",
        username: "root",
        password: "password",
        license: "00000-00000-00000-00000-00000",
        thumbprint: thumbprint.then(thumbprint => thumbprint.id),
        datacenter: datacenter.then(datacenter => datacenter.id),
    });
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    datacenter = vsphere.get_datacenter(name="dc-01")
    thumbprint = vsphere.get_host_thumbprint(address="esxi-01.example.com",
        insecure=True)
    esx_01 = vsphere.Host("esx-01",
        hostname="esxi-01.example.com",
        username="root",
        password="password",
        license="00000-00000-00000-00000-00000",
        thumbprint=thumbprint.id,
        datacenter=datacenter.id)
    
    package main
    
    import (
    	"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
    		}
    		thumbprint, err := vsphere.GetHostThumbprint(ctx, &vsphere.GetHostThumbprintArgs{
    			Address:  "esxi-01.example.com",
    			Insecure: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = vsphere.NewHost(ctx, "esx-01", &vsphere.HostArgs{
    			Hostname:   pulumi.String("esxi-01.example.com"),
    			Username:   pulumi.String("root"),
    			Password:   pulumi.String("password"),
    			License:    pulumi.String("00000-00000-00000-00000-00000"),
    			Thumbprint: pulumi.String(thumbprint.Id),
    			Datacenter: pulumi.String(datacenter.Id),
    		})
    		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 thumbprint = VSphere.GetHostThumbprint.Invoke(new()
        {
            Address = "esxi-01.example.com",
            Insecure = true,
        });
    
        var esx_01 = new VSphere.Host("esx-01", new()
        {
            Hostname = "esxi-01.example.com",
            Username = "root",
            Password = "password",
            License = "00000-00000-00000-00000-00000",
            Thumbprint = thumbprint.Apply(getHostThumbprintResult => getHostThumbprintResult.Id),
            Datacenter = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
        });
    
    });
    
    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.GetHostThumbprintArgs;
    import com.pulumi.vsphere.Host;
    import com.pulumi.vsphere.HostArgs;
    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 thumbprint = VsphereFunctions.getHostThumbprint(GetHostThumbprintArgs.builder()
                .address("esxi-01.example.com")
                .insecure(true)
                .build());
    
            var esx_01 = new Host("esx-01", HostArgs.builder()
                .hostname("esxi-01.example.com")
                .username("root")
                .password("password")
                .license("00000-00000-00000-00000-00000")
                .thumbprint(thumbprint.applyValue(getHostThumbprintResult -> getHostThumbprintResult.id()))
                .datacenter(datacenter.applyValue(getDatacenterResult -> getDatacenterResult.id()))
                .build());
    
        }
    }
    
    resources:
      esx-01:
        type: vsphere:Host
        properties:
          hostname: esxi-01.example.com
          username: root
          password: password
          license: 00000-00000-00000-00000-00000
          thumbprint: ${thumbprint.id}
          datacenter: ${datacenter.id}
    variables:
      datacenter:
        fn::invoke:
          Function: vsphere:getDatacenter
          Arguments:
            name: dc-01
      thumbprint:
        fn::invoke:
          Function: vsphere:getHostThumbprint
          Arguments:
            address: esxi-01.example.com
            insecure: true
    

    Create Host Resource

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

    Constructor syntax

    new Host(name: string, args: HostArgs, opts?: CustomResourceOptions);
    @overload
    def Host(resource_name: str,
             args: HostArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Host(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             hostname: Optional[str] = None,
             username: Optional[str] = None,
             password: Optional[str] = None,
             custom_attributes: Optional[Mapping[str, str]] = None,
             datacenter: Optional[str] = None,
             force: Optional[bool] = None,
             cluster: Optional[str] = None,
             license: Optional[str] = None,
             lockdown: Optional[str] = None,
             maintenance: Optional[bool] = None,
             connected: Optional[bool] = None,
             services: Optional[Sequence[HostServiceArgs]] = None,
             tags: Optional[Sequence[str]] = None,
             thumbprint: Optional[str] = None,
             cluster_managed: Optional[bool] = None)
    func NewHost(ctx *Context, name string, args HostArgs, opts ...ResourceOption) (*Host, error)
    public Host(string name, HostArgs args, CustomResourceOptions? opts = null)
    public Host(String name, HostArgs args)
    public Host(String name, HostArgs args, CustomResourceOptions options)
    
    type: vsphere:Host
    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 HostArgs
    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 HostArgs
    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 HostArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args HostArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args HostArgs
    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 hostResource = new VSphere.Host("hostResource", new()
    {
        Hostname = "string",
        Username = "string",
        Password = "string",
        CustomAttributes = 
        {
            { "string", "string" },
        },
        Datacenter = "string",
        Force = false,
        Cluster = "string",
        License = "string",
        Lockdown = "string",
        Maintenance = false,
        Connected = false,
        Services = new[]
        {
            new VSphere.Inputs.HostServiceArgs
            {
                Ntpd = new VSphere.Inputs.HostServiceNtpdArgs
                {
                    Enabled = false,
                    NtpServers = new[]
                    {
                        "string",
                    },
                    Policy = "string",
                },
            },
        },
        Tags = new[]
        {
            "string",
        },
        Thumbprint = "string",
        ClusterManaged = false,
    });
    
    example, err := vsphere.NewHost(ctx, "hostResource", &vsphere.HostArgs{
    	Hostname: pulumi.String("string"),
    	Username: pulumi.String("string"),
    	Password: pulumi.String("string"),
    	CustomAttributes: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Datacenter:  pulumi.String("string"),
    	Force:       pulumi.Bool(false),
    	Cluster:     pulumi.String("string"),
    	License:     pulumi.String("string"),
    	Lockdown:    pulumi.String("string"),
    	Maintenance: pulumi.Bool(false),
    	Connected:   pulumi.Bool(false),
    	Services: vsphere.HostServiceArray{
    		&vsphere.HostServiceArgs{
    			Ntpd: &vsphere.HostServiceNtpdArgs{
    				Enabled: pulumi.Bool(false),
    				NtpServers: pulumi.StringArray{
    					pulumi.String("string"),
    				},
    				Policy: pulumi.String("string"),
    			},
    		},
    	},
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Thumbprint:     pulumi.String("string"),
    	ClusterManaged: pulumi.Bool(false),
    })
    
    var hostResource = new Host("hostResource", HostArgs.builder()
        .hostname("string")
        .username("string")
        .password("string")
        .customAttributes(Map.of("string", "string"))
        .datacenter("string")
        .force(false)
        .cluster("string")
        .license("string")
        .lockdown("string")
        .maintenance(false)
        .connected(false)
        .services(HostServiceArgs.builder()
            .ntpd(HostServiceNtpdArgs.builder()
                .enabled(false)
                .ntpServers("string")
                .policy("string")
                .build())
            .build())
        .tags("string")
        .thumbprint("string")
        .clusterManaged(false)
        .build());
    
    host_resource = vsphere.Host("hostResource",
        hostname="string",
        username="string",
        password="string",
        custom_attributes={
            "string": "string",
        },
        datacenter="string",
        force=False,
        cluster="string",
        license="string",
        lockdown="string",
        maintenance=False,
        connected=False,
        services=[{
            "ntpd": {
                "enabled": False,
                "ntp_servers": ["string"],
                "policy": "string",
            },
        }],
        tags=["string"],
        thumbprint="string",
        cluster_managed=False)
    
    const hostResource = new vsphere.Host("hostResource", {
        hostname: "string",
        username: "string",
        password: "string",
        customAttributes: {
            string: "string",
        },
        datacenter: "string",
        force: false,
        cluster: "string",
        license: "string",
        lockdown: "string",
        maintenance: false,
        connected: false,
        services: [{
            ntpd: {
                enabled: false,
                ntpServers: ["string"],
                policy: "string",
            },
        }],
        tags: ["string"],
        thumbprint: "string",
        clusterManaged: false,
    });
    
    type: vsphere:Host
    properties:
        cluster: string
        clusterManaged: false
        connected: false
        customAttributes:
            string: string
        datacenter: string
        force: false
        hostname: string
        license: string
        lockdown: string
        maintenance: false
        password: string
        services:
            - ntpd:
                enabled: false
                ntpServers:
                    - string
                policy: string
        tags:
            - string
        thumbprint: string
        username: string
    

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

    Hostname string
    FQDN or IP address of the host to be added.
    Password string
    Password that will be used by vSphere to authenticate to the host.
    Username string
    Username that will be used by vSphere to authenticate to the host.
    Cluster string
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    ClusterManaged bool
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    Connected bool
    If set to false then the host will be disconnected. Default is false.
    CustomAttributes Dictionary<string, string>

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    Datacenter string
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    Force bool
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    License string
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    Lockdown string
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    Maintenance bool
    Set the management state of the host. Default is false.
    Services List<Pulumi.VSphere.Inputs.HostService>
    Set Services on host, the settings to be set are based on service being set as part of import.
    Tags List<string>

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    Thumbprint string
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    Hostname string
    FQDN or IP address of the host to be added.
    Password string
    Password that will be used by vSphere to authenticate to the host.
    Username string
    Username that will be used by vSphere to authenticate to the host.
    Cluster string
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    ClusterManaged bool
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    Connected bool
    If set to false then the host will be disconnected. Default is false.
    CustomAttributes map[string]string

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    Datacenter string
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    Force bool
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    License string
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    Lockdown string
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    Maintenance bool
    Set the management state of the host. Default is false.
    Services []HostServiceArgs
    Set Services on host, the settings to be set are based on service being set as part of import.
    Tags []string

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    Thumbprint string
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    hostname String
    FQDN or IP address of the host to be added.
    password String
    Password that will be used by vSphere to authenticate to the host.
    username String
    Username that will be used by vSphere to authenticate to the host.
    cluster String
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    clusterManaged Boolean
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    connected Boolean
    If set to false then the host will be disconnected. Default is false.
    customAttributes Map<String,String>

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    datacenter String
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    force Boolean
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    license String
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    lockdown String
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    maintenance Boolean
    Set the management state of the host. Default is false.
    services List<HostService>
    Set Services on host, the settings to be set are based on service being set as part of import.
    tags List<String>

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    thumbprint String
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    hostname string
    FQDN or IP address of the host to be added.
    password string
    Password that will be used by vSphere to authenticate to the host.
    username string
    Username that will be used by vSphere to authenticate to the host.
    cluster string
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    clusterManaged boolean
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    connected boolean
    If set to false then the host will be disconnected. Default is false.
    customAttributes {[key: string]: string}

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    datacenter string
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    force boolean
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    license string
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    lockdown string
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    maintenance boolean
    Set the management state of the host. Default is false.
    services HostService[]
    Set Services on host, the settings to be set are based on service being set as part of import.
    tags string[]

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    thumbprint string
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    hostname str
    FQDN or IP address of the host to be added.
    password str
    Password that will be used by vSphere to authenticate to the host.
    username str
    Username that will be used by vSphere to authenticate to the host.
    cluster str
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    cluster_managed bool
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    connected bool
    If set to false then the host will be disconnected. Default is false.
    custom_attributes Mapping[str, str]

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    datacenter str
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    force bool
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    license str
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    lockdown str
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    maintenance bool
    Set the management state of the host. Default is false.
    services Sequence[HostServiceArgs]
    Set Services on host, the settings to be set are based on service being set as part of import.
    tags Sequence[str]

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    thumbprint str
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    hostname String
    FQDN or IP address of the host to be added.
    password String
    Password that will be used by vSphere to authenticate to the host.
    username String
    Username that will be used by vSphere to authenticate to the host.
    cluster String
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    clusterManaged Boolean
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    connected Boolean
    If set to false then the host will be disconnected. Default is false.
    customAttributes Map<String>

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    datacenter String
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    force Boolean
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    license String
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    lockdown String
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    maintenance Boolean
    Set the management state of the host. Default is false.
    services List<Property Map>
    Set Services on host, the settings to be set are based on service being set as part of import.
    tags List<String>

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    thumbprint String
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].

    Outputs

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

    Get an existing Host 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?: HostState, opts?: CustomResourceOptions): Host
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster: Optional[str] = None,
            cluster_managed: Optional[bool] = None,
            connected: Optional[bool] = None,
            custom_attributes: Optional[Mapping[str, str]] = None,
            datacenter: Optional[str] = None,
            force: Optional[bool] = None,
            hostname: Optional[str] = None,
            license: Optional[str] = None,
            lockdown: Optional[str] = None,
            maintenance: Optional[bool] = None,
            password: Optional[str] = None,
            services: Optional[Sequence[HostServiceArgs]] = None,
            tags: Optional[Sequence[str]] = None,
            thumbprint: Optional[str] = None,
            username: Optional[str] = None) -> Host
    func GetHost(ctx *Context, name string, id IDInput, state *HostState, opts ...ResourceOption) (*Host, error)
    public static Host Get(string name, Input<string> id, HostState? state, CustomResourceOptions? opts = null)
    public static Host get(String name, Output<String> id, HostState 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:
    Cluster string
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    ClusterManaged bool
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    Connected bool
    If set to false then the host will be disconnected. Default is false.
    CustomAttributes Dictionary<string, string>

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    Datacenter string
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    Force bool
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    Hostname string
    FQDN or IP address of the host to be added.
    License string
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    Lockdown string
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    Maintenance bool
    Set the management state of the host. Default is false.
    Password string
    Password that will be used by vSphere to authenticate to the host.
    Services List<Pulumi.VSphere.Inputs.HostService>
    Set Services on host, the settings to be set are based on service being set as part of import.
    Tags List<string>

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    Thumbprint string
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    Username string
    Username that will be used by vSphere to authenticate to the host.
    Cluster string
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    ClusterManaged bool
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    Connected bool
    If set to false then the host will be disconnected. Default is false.
    CustomAttributes map[string]string

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    Datacenter string
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    Force bool
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    Hostname string
    FQDN or IP address of the host to be added.
    License string
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    Lockdown string
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    Maintenance bool
    Set the management state of the host. Default is false.
    Password string
    Password that will be used by vSphere to authenticate to the host.
    Services []HostServiceArgs
    Set Services on host, the settings to be set are based on service being set as part of import.
    Tags []string

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    Thumbprint string
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    Username string
    Username that will be used by vSphere to authenticate to the host.
    cluster String
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    clusterManaged Boolean
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    connected Boolean
    If set to false then the host will be disconnected. Default is false.
    customAttributes Map<String,String>

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    datacenter String
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    force Boolean
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    hostname String
    FQDN or IP address of the host to be added.
    license String
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    lockdown String
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    maintenance Boolean
    Set the management state of the host. Default is false.
    password String
    Password that will be used by vSphere to authenticate to the host.
    services List<HostService>
    Set Services on host, the settings to be set are based on service being set as part of import.
    tags List<String>

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    thumbprint String
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    username String
    Username that will be used by vSphere to authenticate to the host.
    cluster string
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    clusterManaged boolean
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    connected boolean
    If set to false then the host will be disconnected. Default is false.
    customAttributes {[key: string]: string}

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    datacenter string
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    force boolean
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    hostname string
    FQDN or IP address of the host to be added.
    license string
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    lockdown string
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    maintenance boolean
    Set the management state of the host. Default is false.
    password string
    Password that will be used by vSphere to authenticate to the host.
    services HostService[]
    Set Services on host, the settings to be set are based on service being set as part of import.
    tags string[]

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    thumbprint string
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    username string
    Username that will be used by vSphere to authenticate to the host.
    cluster str
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    cluster_managed bool
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    connected bool
    If set to false then the host will be disconnected. Default is false.
    custom_attributes Mapping[str, str]

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    datacenter str
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    force bool
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    hostname str
    FQDN or IP address of the host to be added.
    license str
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    lockdown str
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    maintenance bool
    Set the management state of the host. Default is false.
    password str
    Password that will be used by vSphere to authenticate to the host.
    services Sequence[HostServiceArgs]
    Set Services on host, the settings to be set are based on service being set as part of import.
    tags Sequence[str]

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    thumbprint str
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    username str
    Username that will be used by vSphere to authenticate to the host.
    cluster String
    The ID of the Compute Cluster this host should be added to. This should not be set if datacenter is set. Conflicts with: cluster_managed.
    clusterManaged Boolean
    Can be set to true if compute cluster membership will be managed through the compute_cluster resource rather than thehost resource. Conflicts with: cluster.
    connected Boolean
    If set to false then the host will be disconnected. Default is false.
    customAttributes Map<String>

    A map of custom attribute IDs and string values to apply to the resource. Please refer to the vsphere_custom_attributes resource for more information on applying tags to resources.

    NOTE: Custom attributes are not supported on direct ESXi host connections and require vCenter Server.

    datacenter String
    The ID of the datacenter this host should be added to. This should not be set if cluster is set.
    force Boolean
    If set to true then it will force the host to be added, even if the host is already connected to a different vCenter Server instance. Default is false.
    hostname String
    FQDN or IP address of the host to be added.
    license String
    The license key that will be applied to the host. The license key is expected to be present in vSphere.
    lockdown String
    Set the lockdown state of the host. Valid options are disabled, normal, and strict. Default is disabled.
    maintenance Boolean
    Set the management state of the host. Default is false.
    password String
    Password that will be used by vSphere to authenticate to the host.
    services List<Property Map>
    Set Services on host, the settings to be set are based on service being set as part of import.
    tags List<String>

    The IDs of any tags to attach to this resource. Please refer to the vsphere.Tag resource for more information on applying tags to resources.

    NOTE: Tagging support is not supported on direct ESXi host connections and require vCenter Server.

    thumbprint String
    Host's certificate SHA-1 thumbprint. If not set the CA that signed the host's certificate should be trusted. If the CA is not trusted and no thumbprint is set then the operation will fail. See data source [vsphere.getHostThumbprint][docs-host-thumbprint-data-source].
    username String
    Username that will be used by vSphere to authenticate to the host.

    Supporting Types

    HostService, HostServiceArgs

    Ntpd Pulumi.VSphere.Inputs.HostServiceNtpd

    service has three settings, enabled sets service to running or not running, policy sets service based on setting of on which sets service to "Start and stop with host", off which sets service to "Start and stop manually", automatic which sets service to "Start and stop with port usage".

    NOTE: services only supports ntpd service today.

    Ntpd HostServiceNtpd

    service has three settings, enabled sets service to running or not running, policy sets service based on setting of on which sets service to "Start and stop with host", off which sets service to "Start and stop manually", automatic which sets service to "Start and stop with port usage".

    NOTE: services only supports ntpd service today.

    ntpd HostServiceNtpd

    service has three settings, enabled sets service to running or not running, policy sets service based on setting of on which sets service to "Start and stop with host", off which sets service to "Start and stop manually", automatic which sets service to "Start and stop with port usage".

    NOTE: services only supports ntpd service today.

    ntpd HostServiceNtpd

    service has three settings, enabled sets service to running or not running, policy sets service based on setting of on which sets service to "Start and stop with host", off which sets service to "Start and stop manually", automatic which sets service to "Start and stop with port usage".

    NOTE: services only supports ntpd service today.

    ntpd HostServiceNtpd

    service has three settings, enabled sets service to running or not running, policy sets service based on setting of on which sets service to "Start and stop with host", off which sets service to "Start and stop manually", automatic which sets service to "Start and stop with port usage".

    NOTE: services only supports ntpd service today.

    ntpd Property Map

    service has three settings, enabled sets service to running or not running, policy sets service based on setting of on which sets service to "Start and stop with host", off which sets service to "Start and stop manually", automatic which sets service to "Start and stop with port usage".

    NOTE: services only supports ntpd service today.

    HostServiceNtpd, HostServiceNtpdArgs

    Enabled bool
    Whether the NTP service is enabled. Default is false.
    NtpServers List<string>
    Policy string
    The policy for the NTP service. Valid values are 'Start and stop with host', 'Start and stop manually', 'Start and stop with port usage'.
    Enabled bool
    Whether the NTP service is enabled. Default is false.
    NtpServers []string
    Policy string
    The policy for the NTP service. Valid values are 'Start and stop with host', 'Start and stop manually', 'Start and stop with port usage'.
    enabled Boolean
    Whether the NTP service is enabled. Default is false.
    ntpServers List<String>
    policy String
    The policy for the NTP service. Valid values are 'Start and stop with host', 'Start and stop manually', 'Start and stop with port usage'.
    enabled boolean
    Whether the NTP service is enabled. Default is false.
    ntpServers string[]
    policy string
    The policy for the NTP service. Valid values are 'Start and stop with host', 'Start and stop manually', 'Start and stop with port usage'.
    enabled bool
    Whether the NTP service is enabled. Default is false.
    ntp_servers Sequence[str]
    policy str
    The policy for the NTP service. Valid values are 'Start and stop with host', 'Start and stop manually', 'Start and stop with port usage'.
    enabled Boolean
    Whether the NTP service is enabled. Default is false.
    ntpServers List<String>
    policy String
    The policy for the NTP service. Valid values are 'Start and stop with host', 'Start and stop manually', 'Start and stop with port usage'.

    Import

    An existing host can be imported into this resource by supplying

    the host’s ID.

    Obtain the host’s ID using the data source. For example:

    hcl

    data “vsphere_datacenter” “datacenter” {

    name = “dc-01”

    }

    data “vsphere_host” “host” {

    name = “esxi-01.example.com”

    datacenter_id = data.vsphere_datacenter.datacenter.id

    }

    output “host_id” {

    value = data.vsphere_host.host.id

    }

    Next, create a resource configuration, For example:

    hcl

    data “vsphere_datacenter” “datacenter” {

    name = “dc-01”

    }

    data “vsphere_host_thumbprint” “thumbprint” {

    address = “esxi-01.example.com”

    insecure = true

    }

    resource “vsphere_host” “esx-01” {

    hostname = “esxi-01.example.com”

    username = “root”

    password = “password”

    thumbprint = data.vsphere_host_thumbprint.thumbprint.id

    datacenter = data.vsphere_datacenter.datacenter.id

    }

    hcl

    resource “vsphere_host” “esx-01” {

    hostname = “esxi-01.example.com”

    username = “root”

    password = “password”

    license = “00000-00000-00000-00000-00000”

    thumbprint = data.vsphere_host_thumbprint.thumbprint.id

    cluster = data.vsphere_compute_cluster.cluster.id

    services {

    ntpd {
    
      enabled     = true
    
      policy      = "on"
    
      ntp_servers = ["pool.ntp.org"]
    
    }
    

    }

    console

    $ pulumi import vsphere:index/host:Host esx-01 host-123
    

    The above would import the host esxi-01.example.com with the host ID host-123.

    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