vSphere

Pulumi Official
Package maintained by Pulumi
v4.1.0 published on Wednesday, Nov 24, 2021 by Pulumi

getDatacenter

The vsphere.Datacenter data source can be used to discover the ID of a vSphere datacenter. This can then be used with resources or data sources that require a datacenter, such as the vsphere.Host data source.

Example Usage

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
        {
            Name = "dc1",
        }));
    }

}
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 {
		opt0 := "dc1"
		_, err := vsphere.LookupDatacenter(ctx, &GetDatacenterArgs{
			Name: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_vsphere as vsphere

datacenter = vsphere.get_datacenter(name="dc1")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const datacenter = pulumi.output(vsphere.getDatacenter({
    name: "dc1",
}));

Coming soon!

Using getDatacenter

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getDatacenter(args: GetDatacenterArgs, opts?: InvokeOptions): Promise<GetDatacenterResult>
function getDatacenterOutput(args: GetDatacenterOutputArgs, opts?: InvokeOptions): Output<GetDatacenterResult>
def get_datacenter(name: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetDatacenterResult
def get_datacenter_output(name: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetDatacenterResult]
func LookupDatacenter(ctx *Context, args *LookupDatacenterArgs, opts ...InvokeOption) (*LookupDatacenterResult, error)
func LookupDatacenterOutput(ctx *Context, args *LookupDatacenterOutputArgs, opts ...InvokeOption) LookupDatacenterResultOutput

> Note: This function is named LookupDatacenter in the Go SDK.

public static class GetDatacenter 
{
    public static Task<GetDatacenterResult> InvokeAsync(GetDatacenterArgs args, InvokeOptions? opts = null)
    public static Output<GetDatacenterResult> Invoke(GetDatacenterInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDatacenterResult> getDatacenter(GetDatacenterArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: vsphere:index/getDatacenter:getDatacenter
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Name string

The name of the datacenter. This can be a name or path. Can be omitted if there is only one datacenter in your inventory.

Name string

The name of the datacenter. This can be a name or path. Can be omitted if there is only one datacenter in your inventory.

name String

The name of the datacenter. This can be a name or path. Can be omitted if there is only one datacenter in your inventory.

name string

The name of the datacenter. This can be a name or path. Can be omitted if there is only one datacenter in your inventory.

name str

The name of the datacenter. This can be a name or path. Can be omitted if there is only one datacenter in your inventory.

name String

The name of the datacenter. This can be a name or path. Can be omitted if there is only one datacenter in your inventory.

getDatacenter Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Name string
Id string

The provider-assigned unique ID for this managed resource.

Name string
id String

The provider-assigned unique ID for this managed resource.

name String
id string

The provider-assigned unique ID for this managed resource.

name string
id str

The provider-assigned unique ID for this managed resource.

name str
id String

The provider-assigned unique ID for this managed resource.

name String

Package Details

Repository
https://github.com/pulumi/pulumi-vsphere
License
Apache-2.0
Notes

This Pulumi package is based on the vsphere Terraform Provider.