Hetzner Cloud

v1.10.1 published on Wednesday, Aug 3, 2022 by Pulumi

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/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := hcloud.GetLocation(ctx, &GetLocationArgs{
			Name: pulumi.StringRef("fsn1"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.GetLocation(ctx, &GetLocationArgs{
			Id: pulumi.IntRef(1),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var l1 = Output.of(HcloudFunctions.getLocation(GetLocationArgs.builder()
            .name("fsn1")
            .build()));

        final var l2 = Output.of(HcloudFunctions.getLocation(GetLocationArgs.builder()
            .id(1)
            .build()));

    }
}
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",
}));
const l2 = pulumi.output(hcloud.getLocation({
    id: 1,
}));
variables:
  l1:
    Fn::Invoke:
      Function: hcloud:getLocation
      Arguments:
        name: fsn1
  l2:
    Fn::Invoke:
      Function: hcloud:getLocation
      Arguments:
        id: 1

Using getLocation

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 getLocation(args: GetLocationArgs, opts?: InvokeOptions): Promise<GetLocationResult>
function getLocationOutput(args: GetLocationOutputArgs, opts?: InvokeOptions): Output<GetLocationResult>
def get_location(id: Optional[int] = None,
                 name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetLocationResult
def get_location_output(id: Optional[pulumi.Input[int]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetLocationResult]
func GetLocation(ctx *Context, args *GetLocationArgs, opts ...InvokeOption) (*GetLocationResult, error)
func GetLocationOutput(ctx *Context, args *GetLocationOutputArgs, opts ...InvokeOption) GetLocationResultOutput

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

public static class GetLocation 
{
    public static Task<GetLocationResult> InvokeAsync(GetLocationArgs args, InvokeOptions? opts = null)
    public static Output<GetLocationResult> Invoke(GetLocationInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetLocationResult> getLocation(GetLocationArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: hcloud:index/getLocation:getLocation
  arguments:
    # arguments dictionary

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 Integer

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.

id Number

ID of the location.

name String

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.

NetworkZone string

(string) Network Zone 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.

NetworkZone string

(string) Network Zone 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 Integer

(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.

networkZone String

(string) Network Zone 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.

networkZone string

(string) Network Zone 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.

network_zone str

(string) Network Zone 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.

networkZone String

(string) Network Zone 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.