Hetzner Cloud v1.21.1 published on Friday, Nov 22, 2024 by Pulumi
hcloud.getLocation
Explore with Pulumi AI
Provides details about a specific Hetzner Cloud Location.
Use this resource to get detailed information about a specific Location.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const byId = hcloud.getLocation({
id: 1,
});
const byName = hcloud.getLocation({
name: "fsn1",
});
import pulumi
import pulumi_hcloud as hcloud
by_id = hcloud.get_location(id=1)
by_name = hcloud.get_location(name="fsn1")
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, &hcloud.GetLocationArgs{
Id: pulumi.IntRef(1),
}, nil)
if err != nil {
return err
}
_, err = hcloud.GetLocation(ctx, &hcloud.GetLocationArgs{
Name: pulumi.StringRef("fsn1"),
}, 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.GetLocation.Invoke(new()
{
Id = 1,
});
var byName = HCloud.GetLocation.Invoke(new()
{
Name = "fsn1",
});
});
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.GetLocationArgs;
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.getLocation(GetLocationArgs.builder()
.id(1)
.build());
final var byName = HcloudFunctions.getLocation(GetLocationArgs.builder()
.name("fsn1")
.build());
}
}
variables:
byId:
fn::invoke:
Function: hcloud:getLocation
Arguments:
id: 1
byName:
fn::invoke:
Function: hcloud:getLocation
Arguments:
name: fsn1
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:
getLocation Result
The following output properties are available:
- City string
- Name of the closest city to the Location. City name and optionally state in short form.
- Country string
- Country the Location resides in. ISO 3166-1 alpha-2 code of the country.
- Description string
- Description of the Location.
- Latitude double
- Latitude of the city closest to the Location.
- Longitude double
- Longitude of the city closest to the Location.
- Network
Zone string - Name of the Network Zone this Location resides in.
- Id int
- ID of the Location.
- Name string
- Name of the Location.
- City string
- Name of the closest city to the Location. City name and optionally state in short form.
- Country string
- Country the Location resides in. ISO 3166-1 alpha-2 code of the country.
- Description string
- Description of the Location.
- Latitude float64
- Latitude of the city closest to the Location.
- Longitude float64
- Longitude of the city closest to the Location.
- Network
Zone string - Name of the Network Zone this Location resides in.
- Id int
- ID of the Location.
- Name string
- Name of the Location.
- city String
- Name of the closest city to the Location. City name and optionally state in short form.
- country String
- Country the Location resides in. ISO 3166-1 alpha-2 code of the country.
- description String
- Description of the Location.
- latitude Double
- Latitude of the city closest to the Location.
- longitude Double
- Longitude of the city closest to the Location.
- network
Zone String - Name of the Network Zone this Location resides in.
- id Integer
- ID of the Location.
- name String
- Name of the Location.
- city string
- Name of the closest city to the Location. City name and optionally state in short form.
- country string
- Country the Location resides in. ISO 3166-1 alpha-2 code of the country.
- description string
- Description of the Location.
- latitude number
- Latitude of the city closest to the Location.
- longitude number
- Longitude of the city closest to the Location.
- network
Zone string - Name of the Network Zone this Location resides in.
- id number
- ID of the Location.
- name string
- Name of the Location.
- city str
- Name of the closest city to the Location. City name and optionally state in short form.
- country str
- Country the Location resides in. ISO 3166-1 alpha-2 code of the country.
- description str
- Description of the Location.
- latitude float
- Latitude of the city closest to the Location.
- longitude float
- Longitude of the city closest to the Location.
- network_
zone str - Name of the Network Zone this Location resides in.
- id int
- ID of the Location.
- name str
- Name of the Location.
- city String
- Name of the closest city to the Location. City name and optionally state in short form.
- country String
- Country the Location resides in. ISO 3166-1 alpha-2 code of the country.
- description String
- Description of the Location.
- latitude Number
- Latitude of the city closest to the Location.
- longitude Number
- Longitude of the city closest to the Location.
- network
Zone String - Name of the Network Zone this Location resides in.
- id Number
- ID of the Location.
- name String
- Name of the Location.
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloud
Terraform Provider.