1. Packages
  2. Hcloud Provider
  3. API Docs
  4. getDatacenter
Hetzner Cloud v1.21.1 published on Friday, Nov 22, 2024 by Pulumi

hcloud.getDatacenter

Explore with Pulumi AI

hcloud logo
Hetzner Cloud v1.21.1 published on Friday, Nov 22, 2024 by Pulumi

    Provides details about a specific Hetzner Cloud Datacenter.

    Use this resource to get detailed information about a specific Datacenter.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as hcloud from "@pulumi/hcloud";
    
    const byId = hcloud.getDatacenter({
        id: 4,
    });
    const byName = hcloud.getDatacenter({
        name: "fsn1-dc14",
    });
    
    import pulumi
    import pulumi_hcloud as hcloud
    
    by_id = hcloud.get_datacenter(id=4)
    by_name = hcloud.get_datacenter(name="fsn1-dc14")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := hcloud.GetDatacenter(ctx, &hcloud.GetDatacenterArgs{
    			Id: pulumi.IntRef(4),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.GetDatacenter(ctx, &hcloud.GetDatacenterArgs{
    			Name: pulumi.StringRef("fsn1-dc14"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using HCloud = Pulumi.HCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var byId = HCloud.GetDatacenter.Invoke(new()
        {
            Id = 4,
        });
    
        var byName = HCloud.GetDatacenter.Invoke(new()
        {
            Name = "fsn1-dc14",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.hcloud.HcloudFunctions;
    import com.pulumi.hcloud.inputs.GetDatacenterArgs;
    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) {
            final var byId = HcloudFunctions.getDatacenter(GetDatacenterArgs.builder()
                .id(4)
                .build());
    
            final var byName = HcloudFunctions.getDatacenter(GetDatacenterArgs.builder()
                .name("fsn1-dc14")
                .build());
    
        }
    }
    
    variables:
      byId:
        fn::invoke:
          Function: hcloud:getDatacenter
          Arguments:
            id: 4
      byName:
        fn::invoke:
          Function: hcloud:getDatacenter
          Arguments:
            name: fsn1-dc14
    

    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(id: Optional[int] = None,
                       name: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetDatacenterResult
    def get_datacenter_output(id: Optional[pulumi.Input[int]] = None,
                       name: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetDatacenterResult]
    func GetDatacenter(ctx *Context, args *GetDatacenterArgs, opts ...InvokeOption) (*GetDatacenterResult, error)
    func GetDatacenterOutput(ctx *Context, args *GetDatacenterOutputArgs, opts ...InvokeOption) GetDatacenterResultOutput

    > Note: This function is named GetDatacenter 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: hcloud:index/getDatacenter:getDatacenter
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id int
    ID of the Datacenter.
    Name string
    Name of the Datacenter.
    Id int
    ID of the Datacenter.
    Name string
    Name of the Datacenter.
    id Integer
    ID of the Datacenter.
    name String
    Name of the Datacenter.
    id number
    ID of the Datacenter.
    name string
    Name of the Datacenter.
    id int
    ID of the Datacenter.
    name str
    Name of the Datacenter.
    id Number
    ID of the Datacenter.
    name String
    Name of the Datacenter.

    getDatacenter Result

    The following output properties are available:

    AvailableServerTypeIds List<int>
    List of currently available Server Types in the Datacenter.
    Description string
    Description of the Datacenter.
    Location Dictionary<string, string>
    Location of the Datacenter. See the Hetzner Docs for more details about locations.
    SupportedServerTypeIds List<int>
    List of supported Server Types in the Datacenter.
    Id int
    ID of the Datacenter.
    Name string
    Name of the Datacenter.
    AvailableServerTypeIds []int
    List of currently available Server Types in the Datacenter.
    Description string
    Description of the Datacenter.
    Location map[string]string
    Location of the Datacenter. See the Hetzner Docs for more details about locations.
    SupportedServerTypeIds []int
    List of supported Server Types in the Datacenter.
    Id int
    ID of the Datacenter.
    Name string
    Name of the Datacenter.
    availableServerTypeIds List<Integer>
    List of currently available Server Types in the Datacenter.
    description String
    Description of the Datacenter.
    location Map<String,String>
    Location of the Datacenter. See the Hetzner Docs for more details about locations.
    supportedServerTypeIds List<Integer>
    List of supported Server Types in the Datacenter.
    id Integer
    ID of the Datacenter.
    name String
    Name of the Datacenter.
    availableServerTypeIds number[]
    List of currently available Server Types in the Datacenter.
    description string
    Description of the Datacenter.
    location {[key: string]: string}
    Location of the Datacenter. See the Hetzner Docs for more details about locations.
    supportedServerTypeIds number[]
    List of supported Server Types in the Datacenter.
    id number
    ID of the Datacenter.
    name string
    Name of the Datacenter.
    available_server_type_ids Sequence[int]
    List of currently available Server Types in the Datacenter.
    description str
    Description of the Datacenter.
    location Mapping[str, str]
    Location of the Datacenter. See the Hetzner Docs for more details about locations.
    supported_server_type_ids Sequence[int]
    List of supported Server Types in the Datacenter.
    id int
    ID of the Datacenter.
    name str
    Name of the Datacenter.
    availableServerTypeIds List<Number>
    List of currently available Server Types in the Datacenter.
    description String
    Description of the Datacenter.
    location Map<String>
    Location of the Datacenter. See the Hetzner Docs for more details about locations.
    supportedServerTypeIds List<Number>
    List of supported Server Types in the Datacenter.
    id Number
    ID of the Datacenter.
    name String
    Name of the Datacenter.

    Package Details

    Repository
    Hetzner Cloud pulumi/pulumi-hcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the hcloud Terraform Provider.
    hcloud logo
    Hetzner Cloud v1.21.1 published on Friday, Nov 22, 2024 by Pulumi