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
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const prodDatacenter = new vsphere.Datacenter("prod_datacenter", {name: "my_prod_datacenter"});
import pulumi
import pulumi_vsphere as vsphere
prod_datacenter = vsphere.Datacenter("prod_datacenter", name="my_prod_datacenter")
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, "prod_datacenter", &vsphere.DatacenterArgs{
Name: pulumi.String("my_prod_datacenter"),
})
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 prodDatacenter = new VSphere.Datacenter("prod_datacenter", new()
{
Name = "my_prod_datacenter",
});
});
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 prodDatacenter = new Datacenter("prodDatacenter", DatacenterArgs.builder()
.name("my_prod_datacenter")
.build());
}
}
resources:
prodDatacenter:
type: vsphere:Datacenter
name: prod_datacenter
properties:
name: my_prod_datacenter
Create datacenter on a subfolder
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const researchDatacenter = new vsphere.Datacenter("research_datacenter", {
name: "my_research_datacenter",
folder: "/research/",
});
import pulumi
import pulumi_vsphere as vsphere
research_datacenter = vsphere.Datacenter("research_datacenter",
name="my_research_datacenter",
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, "research_datacenter", &vsphere.DatacenterArgs{
Name: pulumi.String("my_research_datacenter"),
Folder: pulumi.String("/research/"),
})
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 researchDatacenter = new VSphere.Datacenter("research_datacenter", new()
{
Name = "my_research_datacenter",
Folder = "/research/",
});
});
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()
.name("my_research_datacenter")
.folder("/research/")
.build());
}
}
resources:
researchDatacenter:
type: vsphere:Datacenter
name: research_datacenter
properties:
name: my_research_datacenter
folder: /research/
Create Datacenter Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Datacenter(name: string, args?: DatacenterArgs, opts?: CustomResourceOptions);
@overload
def Datacenter(resource_name: str,
args: Optional[DatacenterArgs] = None,
opts: Optional[ResourceOptions] = None)
@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)
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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var datacenterResource = new VSphere.Datacenter("datacenterResource", new()
{
CustomAttributes =
{
{ "string", "string" },
},
Folder = "string",
Name = "string",
Tags = new[]
{
"string",
},
});
example, err := vsphere.NewDatacenter(ctx, "datacenterResource", &vsphere.DatacenterArgs{
CustomAttributes: pulumi.StringMap{
"string": pulumi.String("string"),
},
Folder: pulumi.String("string"),
Name: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
})
var datacenterResource = new Datacenter("datacenterResource", DatacenterArgs.builder()
.customAttributes(Map.of("string", "string"))
.folder("string")
.name("string")
.tags("string")
.build());
datacenter_resource = vsphere.Datacenter("datacenterResource",
custom_attributes={
"string": "string",
},
folder="string",
name="string",
tags=["string"])
const datacenterResource = new vsphere.Datacenter("datacenterResource", {
customAttributes: {
string: "string",
},
folder: "string",
name: "string",
tags: ["string"],
});
type: vsphere:Datacenter
properties:
customAttributes:
string: string
folder: string
name: string
tags:
- string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Datacenter resource accepts the following input properties:
- Custom
Attributes 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.
- List<string>
- The IDs of any tags to attach to this resource.
- Custom
Attributes 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.
- []string
- The IDs of any tags to attach to this resource.
- custom
Attributes 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.
- List<String>
- The IDs of any tags to attach to this resource.
- custom
Attributes {[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.
- 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 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.
- Sequence[str]
- The IDs of any tags to attach to this resource.
- custom
Attributes 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.
- List<String>
- 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:
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.
- Custom
Attributes 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.
- List<string>
- The IDs of any tags to attach to this resource.
- Custom
Attributes 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.
- []string
- The IDs of any tags to attach to this resource.
- custom
Attributes 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.
- List<String>
- The IDs of any tags to attach to this resource.
- custom
Attributes {[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.
- 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 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.
- Sequence[str]
- The IDs of any tags to attach to this resource.
- custom
Attributes 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.
- List<String>
- The IDs of any tags to attach to this resource.
Import
An existing datacenter can be imported into this resource
via supplying the full path to the datacenter. An example is below:
$ pulumi import vsphere:index/datacenter:Datacenter dc /dc1
The above would import the datacenter named dc1
.
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.