vsphere logo
vSphere v4.5.0, May 24 23

vsphere.Datacenter

Explore with Pulumi AI

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 System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;

return await Deployment.RunAsync(() => 
{
    var prodDatacenter = new VSphere.Datacenter("prodDatacenter");

});
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 {
		_, err := vsphere.NewDatacenter(ctx, "prodDatacenter", nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vsphere.Datacenter;
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) {
        var prodDatacenter = new Datacenter("prodDatacenter");

    }
}
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("prodDatacenter", {});
resources:
  prodDatacenter:
    type: vsphere:Datacenter

Create datacenter on a subfolder

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;

return await Deployment.RunAsync(() => 
{
    var researchDatacenter = new VSphere.Datacenter("researchDatacenter", new()
    {
        Folder = "/research/",
    });

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

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vsphere.Datacenter;
import com.pulumi.vsphere.DatacenterArgs;
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) {
        var researchDatacenter = new Datacenter("researchDatacenter", DatacenterArgs.builder()        
            .folder("/research/")
            .build());

    }
}
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("researchDatacenter", {folder: "/research/"});
resources:
  researchDatacenter:
    type: vsphere:Datacenter
    properties:
      folder: /research/

Create Datacenter Resource

new Datacenter(name: string, args?: DatacenterArgs, opts?: CustomResourceOptions);
@overload
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)
@overload
def Datacenter(resource_name: str,
               args: Optional[DatacenterArgs] = None,
               opts: Optional[ResourceOptions] = None)
func NewDatacenter(ctx *Context, name string, args *DatacenterArgs, opts ...ResourceOption) (*Datacenter, error)
public Datacenter(string name, DatacenterArgs? args = null, CustomResourceOptions? opts = null)
public Datacenter(String name, DatacenterArgs args)
public Datacenter(String name, DatacenterArgs args, CustomResourceOptions options)
type: vsphere:Datacenter
properties: # The arguments to resource properties.
options: # 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.
resource_name str
The unique name of the resource.
args DatacenterArgs
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 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.
name String
The unique name of the resource.
args DatacenterArgs
The arguments to resource properties.
options 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 Architecture and Concepts 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 for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

CustomAttributes map[string]string

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

customAttributes Map<String,String>

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

customAttributes {[key: string]: string}

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

custom_attributes Mapping[str, str]

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

customAttributes Map<String>

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

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

id String

The provider-assigned unique ID for this managed resource.

moid String

Managed object ID of this datacenter.

Look up 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)
public static Datacenter get(String name, Output<String> id, DatacenterState 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:
CustomAttributes Dictionary<string, string>

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

CustomAttributes map[string]string

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

customAttributes Map<String,String>

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

customAttributes {[key: string]: string}

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

custom_attributes Mapping[str, str]

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

customAttributes Map<String>

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

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

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.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

Package Details

Repository
vSphere pulumi/pulumi-vsphere
License
Apache-2.0
Notes

This Pulumi package is based on the vsphere Terraform Provider.