1. Packages
  2. Hcloud Provider
  3. API Docs
  4. getDatacenter
Hetzner Cloud v1.21.0 published on Tuesday, Nov 12, 2024 by Pulumi

hcloud.getDatacenter

Explore with Pulumi AI

hcloud logo
Hetzner Cloud v1.21.0 published on Tuesday, Nov 12, 2024 by Pulumi

    Provides details about a specific Hetzner Cloud Datacenter. Use this resource to get detailed information about specific datacenter.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as hcloud from "@pulumi/hcloud";
    
    const ds1 = hcloud.getDatacenter({
        name: "fsn1-dc8",
    });
    const ds2 = hcloud.getDatacenter({
        id: 4,
    });
    
    import pulumi
    import pulumi_hcloud as hcloud
    
    ds1 = hcloud.get_datacenter(name="fsn1-dc8")
    ds2 = hcloud.get_datacenter(id=4)
    
    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{
    			Name: pulumi.StringRef("fsn1-dc8"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.GetDatacenter(ctx, &hcloud.GetDatacenterArgs{
    			Id: pulumi.IntRef(4),
    		}, 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 ds1 = HCloud.GetDatacenter.Invoke(new()
        {
            Name = "fsn1-dc8",
        });
    
        var ds2 = HCloud.GetDatacenter.Invoke(new()
        {
            Id = 4,
        });
    
    });
    
    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 ds1 = HcloudFunctions.getDatacenter(GetDatacenterArgs.builder()
                .name("fsn1-dc8")
                .build());
    
            final var ds2 = HcloudFunctions.getDatacenter(GetDatacenterArgs.builder()
                .id(4)
                .build());
    
        }
    }
    
    variables:
      ds1:
        fn::invoke:
          Function: hcloud:getDatacenter
          Arguments:
            name: fsn1-dc8
      ds2:
        fn::invoke:
          Function: hcloud:getDatacenter
          Arguments:
            id: 4
    

    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) List of available server types.
    Description string
    (string) Description of the datacenter.
    Id int
    (int) Unique ID of the datacenter.
    Location Dictionary<string, string>
    (map) Location details of the datacenter. See the Hetzner Docs for more details about locations.
    Name string
    (string) Name of the datacenter.
    SupportedServerTypeIds List<int>
    (list) List of server types supported by the datacenter.
    AvailableServerTypeIds []int
    (list) List of available server types.
    Description string
    (string) Description of the datacenter.
    Id int
    (int) Unique ID of the datacenter.
    Location map[string]string
    (map) Location details of the datacenter. See the Hetzner Docs for more details about locations.
    Name string
    (string) Name of the datacenter.
    SupportedServerTypeIds []int
    (list) List of server types supported by the datacenter.
    availableServerTypeIds List<Integer>
    (list) List of available server types.
    description String
    (string) Description of the datacenter.
    id Integer
    (int) Unique ID of the datacenter.
    location Map<String,String>
    (map) Location details of the datacenter. See the Hetzner Docs for more details about locations.
    name String
    (string) Name of the datacenter.
    supportedServerTypeIds List<Integer>
    (list) List of server types supported by the datacenter.
    availableServerTypeIds number[]
    (list) List of available server types.
    description string
    (string) Description of the datacenter.
    id number
    (int) Unique ID of the datacenter.
    location {[key: string]: string}
    (map) Location details of the datacenter. See the Hetzner Docs for more details about locations.
    name string
    (string) Name of the datacenter.
    supportedServerTypeIds number[]
    (list) List of server types supported by the datacenter.
    available_server_type_ids Sequence[int]
    (list) List of available server types.
    description str
    (string) Description of the datacenter.
    id int
    (int) Unique ID of the datacenter.
    location Mapping[str, str]
    (map) Location details of the datacenter. See the Hetzner Docs for more details about locations.
    name str
    (string) Name of the datacenter.
    supported_server_type_ids Sequence[int]
    (list) List of server types supported by the datacenter.
    availableServerTypeIds List<Number>
    (list) List of available server types.
    description String
    (string) Description of the datacenter.
    id Number
    (int) Unique ID of the datacenter.
    location Map<String>
    (map) Location details of the datacenter. See the Hetzner Docs for more details about locations.
    name String
    (string) Name of the datacenter.
    supportedServerTypeIds List<Number>
    (list) List of server types supported by 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.0 published on Tuesday, Nov 12, 2024 by Pulumi