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

Datacenter

Provides a VMware vSphere datacenter resource. This can be used as the primary container of inventory objects such as hosts and virtual machines.

Example Usage

Create datacenter on the root folder

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var prodDatacenter = new VSphere.Datacenter("prodDatacenter", new VSphere.DatacenterArgs
        {
        });
    }

}
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 {
        _, err := vsphere.NewDatacenter(ctx, "prodDatacenter", nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_vsphere as vsphere

prod_datacenter = vsphere.Datacenter("prodDatacenter")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const prodDatacenter = new vsphere.Datacenter("prod_datacenter", {});

Create datacenter on a subfolder

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var researchDatacenter = new VSphere.Datacenter("researchDatacenter", new VSphere.DatacenterArgs
        {
            Folder = "/research/",
        });
    }

}
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 {
        _, err := vsphere.NewDatacenter(ctx, "researchDatacenter", &vsphere.DatacenterArgs{
            Folder: pulumi.String("/research/"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_vsphere as vsphere

research_datacenter = vsphere.Datacenter("researchDatacenter", folder="/research/")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const researchDatacenter = new vsphere.Datacenter("research_datacenter", {
    folder: "/research/",
});

Create a Datacenter Resource

new Datacenter(name: string, args?: DatacenterArgs, opts?: CustomResourceOptions);
def Datacenter(resource_name: str, opts: Optional[ResourceOptions] = None, custom_attributes: Optional[Mapping[str, str]] = None, folder: Optional[str] = None, name: Optional[str] = None, tags: Optional[Sequence[str]] = None)
func NewDatacenter(ctx *Context, name string, args *DatacenterArgs, opts ...ResourceOption) (*Datacenter, error)
public Datacenter(string name, DatacenterArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args DatacenterArgs
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 DatacenterArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DatacenterArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Datacenter Resource Properties

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

Inputs

The Datacenter resource accepts the following input properties:

CustomAttributes Dictionary<string, string>

Map of custom attribute ids to value strings to set for datacenter resource. See [here][docs-setting-custom-attributes] for a reference on how to set values for custom attributes.

Folder string

The folder where the datacenter should be created. Forces a new resource if changed.

Name string

The name of the datacenter. This name needs to be unique within the folder. Forces a new resource if changed.

Tags List<string>

The IDs of any tags to attach to this resource.

CustomAttributes map[string]string

Map of custom attribute ids to value strings to set for datacenter resource. See [here][docs-setting-custom-attributes] for a reference on how to set values for custom attributes.

Folder string

The folder where the datacenter should be created. Forces a new resource if changed.

Name string

The name of the datacenter. This name needs to be unique within the folder. Forces a new resource if changed.

Tags []string

The IDs of any tags to attach to this resource.

customAttributes {[key: string]: string}

Map of custom attribute ids to value strings to set for datacenter resource. See [here][docs-setting-custom-attributes] for a reference on how to set values for custom attributes.

folder string

The folder where the datacenter should be created. Forces a new resource if changed.

name string

The name of the datacenter. This name needs to be unique within the folder. Forces a new resource if changed.

tags string[]

The IDs of any tags to attach to this resource.

custom_attributes Mapping[str, str]

Map of custom attribute ids to value strings to set for datacenter resource. See [here][docs-setting-custom-attributes] for a reference on how to set values for custom attributes.

folder str

The folder where the datacenter should be created. Forces a new resource if changed.

name str

The name of the datacenter. This name needs to be unique within the folder. Forces a new resource if changed.

tags Sequence[str]

The IDs of any tags to attach to this resource.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Moid string

Managed object ID of this datacenter.

Id string
The provider-assigned unique ID for this managed resource.
Moid string

Managed object ID of this datacenter.

id string
The provider-assigned unique ID for this managed resource.
moid string

Managed object ID of this datacenter.

id str
The provider-assigned unique ID for this managed resource.
moid str

Managed object ID of this datacenter.

Look up an Existing Datacenter Resource

Get an existing Datacenter 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?: DatacenterState, opts?: CustomResourceOptions): Datacenter
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, custom_attributes: Optional[Mapping[str, str]] = None, folder: Optional[str] = None, moid: Optional[str] = None, name: Optional[str] = None, tags: Optional[Sequence[str]] = None) -> Datacenter
func GetDatacenter(ctx *Context, name string, id IDInput, state *DatacenterState, opts ...ResourceOption) (*Datacenter, error)
public static Datacenter Get(string name, Input<string> id, DatacenterState? 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:

CustomAttributes Dictionary<string, string>

Map of custom attribute ids to value strings to set for datacenter resource. See [here][docs-setting-custom-attributes] for a reference on how to set values for custom attributes.

Folder string

The folder where the datacenter should be created. Forces a new resource if changed.

Moid string

Managed object ID of this datacenter.

Name string

The name of the datacenter. This name needs to be unique within the folder. Forces a new resource if changed.

Tags List<string>

The IDs of any tags to attach to this resource.

CustomAttributes map[string]string

Map of custom attribute ids to value strings to set for datacenter resource. See [here][docs-setting-custom-attributes] for a reference on how to set values for custom attributes.

Folder string

The folder where the datacenter should be created. Forces a new resource if changed.

Moid string

Managed object ID of this datacenter.

Name string

The name of the datacenter. This name needs to be unique within the folder. Forces a new resource if changed.

Tags []string

The IDs of any tags to attach to this resource.

customAttributes {[key: string]: string}

Map of custom attribute ids to value strings to set for datacenter resource. See [here][docs-setting-custom-attributes] for a reference on how to set values for custom attributes.

folder string

The folder where the datacenter should be created. Forces a new resource if changed.

moid string

Managed object ID of this datacenter.

name string

The name of the datacenter. This name needs to be unique within the folder. Forces a new resource if changed.

tags string[]

The IDs of any tags to attach to this resource.

custom_attributes Mapping[str, str]

Map of custom attribute ids to value strings to set for datacenter resource. See [here][docs-setting-custom-attributes] for a reference on how to set values for custom attributes.

folder str

The folder where the datacenter should be created. Forces a new resource if changed.

moid str

Managed object ID of this datacenter.

name str

The name of the datacenter. This name needs to be unique within the folder. Forces a new resource if changed.

tags Sequence[str]

The IDs of any tags to attach to this resource.

Package Details

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