Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

GetLocation

Provides details about a specific Hetzner Cloud Location. Use this resource to get detailed information about specific location.

Example Usage

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var l1 = Output.Create(HCloud.GetLocation.InvokeAsync(new HCloud.GetLocationArgs
        {
            Name = "fsn1",
        }));
        var l2 = Output.Create(HCloud.GetLocation.InvokeAsync(new HCloud.GetLocationArgs
        {
            Id = 1,
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := "fsn1"
        _, err := hcloud.GetLocation(ctx, &hcloud.GetLocationArgs{
            Name: &opt0,
        }, nil)
        if err != nil {
            return err
        }
        opt1 := 1
        _, err = hcloud.GetLocation(ctx, &hcloud.GetLocationArgs{
            Id: &opt1,
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_hcloud as hcloud

l1 = hcloud.get_location(name="fsn1")
l2 = hcloud.get_location(id=1)
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const l1 = pulumi.output(hcloud.getLocation({
    name: "fsn1",
}, { async: true }));
const l2 = pulumi.output(hcloud.getLocation({
    id: 1,
}, { async: true }));

Using GetLocation

function getLocation(args: GetLocationArgs, opts?: InvokeOptions): Promise<GetLocationResult>
def get_location(id: Optional[int] = None, name: Optional[str] = None, opts: Optional[InvokeOptions] = None) -> GetLocationResult
func GetLocation(ctx *Context, args *GetLocationArgs, opts ...InvokeOption) (*GetLocationResult, error)
public static class GetLocation {
    public static Task<GetLocationResult> InvokeAsync(GetLocationArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Id int

ID of the location.

Name string

Name of the location.

Id int

ID of the location.

Name string

Name of the location.

id number

ID of the location.

name string

Name of the location.

id int

ID of the location.

name str

Name of the location.

GetLocation Result

The following output properties are available:

City string

(string) City of the location.

Country string

(string) Country of the location.

Description string

(string) Description of the location.

Id int

(int) Unique ID of the location.

Latitude double

(float) Latitude of the city.

Longitude double

(float) Longitude of the city.

Name string

(string) Name of the location.

City string

(string) City of the location.

Country string

(string) Country of the location.

Description string

(string) Description of the location.

Id int

(int) Unique ID of the location.

Latitude float64

(float) Latitude of the city.

Longitude float64

(float) Longitude of the city.

Name string

(string) Name of the location.

city string

(string) City of the location.

country string

(string) Country of the location.

description string

(string) Description of the location.

id number

(int) Unique ID of the location.

latitude number

(float) Latitude of the city.

longitude number

(float) Longitude of the city.

name string

(string) Name of the location.

city str

(string) City of the location.

country str

(string) Country of the location.

description str

(string) Description of the location.

id int

(int) Unique ID of the location.

latitude float

(float) Latitude of the city.

longitude float

(float) Longitude of the city.

name str

(string) Name of the location.

Package Details

Repository
https://github.com/pulumi/pulumi-hcloud
License
Apache-2.0
Notes
This Pulumi package is based on the hcloud Terraform Provider.