Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

Host

Provides a VMware vSphere host resource. This represents an ESXi host that can be used either as part of a Compute Cluster or Standalone.

Importing

An existing host can be imported into this resource via supplying the host’s ID. An example is below:

import * as pulumi from "@pulumi/pulumi";
import pulumi
using Pulumi;

class MyStack : Stack
{
    public MyStack()
    {
    }

}
package main

import (
	"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		return nil
	})
}

The above would import the host with ID host-123.

Example Usage

Create a standalone host

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var dc = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
        {
            Name = "my-datacenter",
        }));
        var h1 = new VSphere.Host("h1", new VSphere.HostArgs
        {
            Hostname = "10.10.10.1",
            Username = "root",
            Password = "password",
            License = "00000-00000-00000-00000i-00000",
            Datacenter = dc.Apply(dc => dc.Id),
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-vsphere/sdk/v2/go/vsphere"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := "my-datacenter"
        dc, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
            Name: &opt0,
        }, nil)
        if err != nil {
            return err
        }
        _, err = vsphere.NewHost(ctx, "h1", &vsphere.HostArgs{
            Hostname:   pulumi.String("10.10.10.1"),
            Username:   pulumi.String("root"),
            Password:   pulumi.String("password"),
            License:    pulumi.String("00000-00000-00000-00000i-00000"),
            Datacenter: pulumi.String(dc.Id),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_vsphere as vsphere

dc = vsphere.get_datacenter(name="my-datacenter")
h1 = vsphere.Host("h1",
    hostname="10.10.10.1",
    username="root",
    password="password",
    license="00000-00000-00000-00000i-00000",
    datacenter=dc.id)
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const dc = vsphere.getDatacenter({
    name: "my-datacenter",
});
const h1 = new vsphere.Host("h1", {
    hostname: "10.10.10.1",
    username: "root",
    password: "password",
    license: "00000-00000-00000-00000i-00000",
    datacenter: dc.then(dc => dc.id),
});

Create host in a compute cluster

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var dc = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
        {
            Name = "TfDatacenter",
        }));
        var c1 = dc.Apply(dc => Output.Create(VSphere.GetComputeCluster.InvokeAsync(new VSphere.GetComputeClusterArgs
        {
            Name = "DC0_C0",
            DatacenterId = dc.Id,
        })));
        var h1 = new VSphere.Host("h1", new VSphere.HostArgs
        {
            Hostname = "10.10.10.1",
            Username = "root",
            Password = "password",
            License = "00000-00000-00000-00000i-00000",
            Cluster = c1.Apply(c1 => c1.Id),
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-vsphere/sdk/v2/go/vsphere"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := "TfDatacenter"
        dc, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
            Name: &opt0,
        }, nil)
        if err != nil {
            return err
        }
        opt1 := dc.Id
        c1, err := vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{
            Name:         "DC0_C0",
            DatacenterId: &opt1,
        }, nil)
        if err != nil {
            return err
        }
        _, err = vsphere.NewHost(ctx, "h1", &vsphere.HostArgs{
            Hostname: pulumi.String("10.10.10.1"),
            Username: pulumi.String("root"),
            Password: pulumi.String("password"),
            License:  pulumi.String("00000-00000-00000-00000i-00000"),
            Cluster:  pulumi.String(c1.Id),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_vsphere as vsphere

dc = vsphere.get_datacenter(name="TfDatacenter")
c1 = vsphere.get_compute_cluster(name="DC0_C0",
    datacenter_id=dc.id)
h1 = vsphere.Host("h1",
    hostname="10.10.10.1",
    username="root",
    password="password",
    license="00000-00000-00000-00000i-00000",
    cluster=c1.id)
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const dc = vsphere.getDatacenter({
    name: "TfDatacenter",
});
const c1 = dc.then(dc => vsphere.getComputeCluster({
    name: "DC0_C0",
    datacenterId: dc.id,
}));
const h1 = new vsphere.Host("h1", {
    hostname: "10.10.10.1",
    username: "root",
    password: "password",
    license: "00000-00000-00000-00000i-00000",
    cluster: c1.then(c1 => c1.id),
});

Create a Host Resource

new Host(name: string, args: HostArgs, opts?: CustomResourceOptions);
def Host(resource_name: str, opts: Optional[ResourceOptions] = None, cluster: Optional[str] = None, cluster_managed: Optional[bool] = None, connected: Optional[bool] = 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, thumbprint: Optional[str] = None, username: Optional[str] = None)
func NewHost(ctx *Context, name string, args HostArgs, opts ...ResourceOption) (*Host, error)
public Host(string name, HostArgs args, CustomResourceOptions? opts = null)
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.
opts ResourceOptions
A bag of options that control this 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.

Host Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

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.

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 disconected. Default is false.

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 vSphere 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.

Thumbprint string

Host’s certificate SHA-1 thumbprint. If not set the 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.

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.

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 disconected. Default is false.

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 vSphere 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.

Thumbprint string

Host’s certificate SHA-1 thumbprint. If not set the 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.

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.

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 disconected. Default is false.

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 vSphere 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.

thumbprint string

Host’s certificate SHA-1 thumbprint. If not set the 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.

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.

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 disconected. Default is false.

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 vSphere 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.

thumbprint str

Host’s certificate SHA-1 thumbprint. If not set the 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.

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 str
The provider-assigned unique ID for this managed resource.

Look up an 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, 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, 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)
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.

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.

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 disconected. Default is false.

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 vSphere 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.

Thumbprint string

Host’s certificate SHA-1 thumbprint. If not set the 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.

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.

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 disconected. Default is false.

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 vSphere 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.

Thumbprint string

Host’s certificate SHA-1 thumbprint. If not set the 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.

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.

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 disconected. Default is false.

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 vSphere 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.

thumbprint string

Host’s certificate SHA-1 thumbprint. If not set the 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.

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.

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 disconected. Default is false.

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 vSphere 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.

thumbprint str

Host’s certificate SHA-1 thumbprint. If not set the 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.

username str

Username that will be used by vSphere to authenticate to the host.

Package Details

Repository
https://github.com/pulumi/pulumi-vsphere
License
Apache-2.0
Notes
This Pulumi package is based on the vsphere Terraform Provider.