Viewing docs for Hetzner Cloud v1.41.0
published on Wednesday, Jul 29, 2026 by Pulumi
published on Wednesday, Jul 29, 2026 by Pulumi
Viewing docs for Hetzner Cloud v1.41.0
published on Wednesday, Jul 29, 2026 by Pulumi
published on Wednesday, Jul 29, 2026 by Pulumi
Provides details about a Hetzner Cloud Server. This resource is useful if you want to use a non-terraform managed server.
Deprecations
datacenter attribute
The datacenter attribute is marked for removal since v1.67.0, you must use the location attribute instead.
See our deprecation and removal changelog for more details.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const s1 = hcloud.getServer({
name: "my-server",
});
const s2 = hcloud.getServer({
id: 123,
});
const s3 = hcloud.getServer({
withSelector: "key=value",
});
import pulumi
import pulumi_hcloud as hcloud
s1 = hcloud.get_server(name="my-server")
s2 = hcloud.get_server(id=123)
s3 = hcloud.get_server(with_selector="key=value")
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.GetServer(ctx, &hcloud.LookupServerArgs{
Name: pulumi.StringRef("my-server"),
}, nil)
if err != nil {
return err
}
_, err = hcloud.GetServer(ctx, &hcloud.LookupServerArgs{
Id: pulumi.IntRef(123),
}, nil)
if err != nil {
return err
}
_, err = hcloud.GetServer(ctx, &hcloud.LookupServerArgs{
WithSelector: pulumi.StringRef("key=value"),
}, 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 s1 = HCloud.GetServer.Invoke(new()
{
Name = "my-server",
});
var s2 = HCloud.GetServer.Invoke(new()
{
Id = 123,
});
var s3 = HCloud.GetServer.Invoke(new()
{
WithSelector = "key=value",
});
});
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.GetServerArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 s1 = HcloudFunctions.getServer(GetServerArgs.builder()
.name("my-server")
.build());
final var s2 = HcloudFunctions.getServer(GetServerArgs.builder()
.id(123)
.build());
final var s3 = HcloudFunctions.getServer(GetServerArgs.builder()
.withSelector("key=value")
.build());
}
}
variables:
s1:
fn::invoke:
function: hcloud:getServer
arguments:
name: my-server
s2:
fn::invoke:
function: hcloud:getServer
arguments:
id: '123'
s3:
fn::invoke:
function: hcloud:getServer
arguments:
withSelector: key=value
pulumi {
required_providers {
hcloud = {
source = "pulumi/hcloud"
}
}
}
data "hcloud_getserver" "s1" {
name = "my-server"
}
data "hcloud_getserver" "s2" {
id = "123"
}
data "hcloud_getserver" "s3" {
with_selector = "key=value"
}
Using getServer
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 getServer(args: GetServerArgs, opts?: InvokeOptions): Promise<GetServerResult>
function getServerOutput(args: GetServerOutputArgs, opts?: InvokeOptions): Output<GetServerResult>def get_server(id: Optional[int] = None,
name: Optional[str] = None,
networks: Optional[Sequence[GetServerNetwork]] = None,
placement_group_id: Optional[int] = None,
selector: Optional[str] = None,
with_selector: Optional[str] = None,
with_statuses: Optional[Sequence[str]] = None,
opts: Optional[InvokeOptions] = None) -> GetServerResult
def get_server_output(id: pulumi.Input[Optional[int]] = None,
name: pulumi.Input[Optional[str]] = None,
networks: pulumi.Input[Optional[Sequence[pulumi.Input[GetServerNetworkArgs]]]] = None,
placement_group_id: pulumi.Input[Optional[int]] = None,
selector: pulumi.Input[Optional[str]] = None,
with_selector: pulumi.Input[Optional[str]] = None,
with_statuses: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetServerResult]func LookupServer(ctx *Context, args *LookupServerArgs, opts ...InvokeOption) (*LookupServerResult, error)
func LookupServerOutput(ctx *Context, args *LookupServerOutputArgs, opts ...InvokeOption) LookupServerResultOutput> Note: This function is named LookupServer in the Go SDK.
public static class GetServer
{
public static Task<GetServerResult> InvokeAsync(GetServerArgs args, InvokeOptions? opts = null)
public static Output<GetServerResult> Invoke(GetServerInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetServerResult> getServer(GetServerArgs args, InvokeOptions options)
public static Output<GetServerResult> getServer(GetServerArgs args, InvokeOptions options)
fn::invoke:
function: hcloud:index/getServer:getServer
arguments:
# arguments dictionarydata "hcloud_get_server" "name" {
# arguments
}The following arguments are supported:
- Id int
- ID of the server.
- Name string
- Name of the server.
- Networks
List<Pulumi.
HCloud. Inputs. Get Server Network> - (map) Private Network the server is attached to.
- Placement
Group intId - (Optional, string) Placement Group ID the server is assigned to.
- Selector string
- With
Selector string - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- With
Statuses List<string> - List only servers with the specified status, could contain
initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- Id int
- ID of the server.
- Name string
- Name of the server.
- Networks
[]Get
Server Network Type - (map) Private Network the server is attached to.
- Placement
Group intId - (Optional, string) Placement Group ID the server is assigned to.
- Selector string
- With
Selector string - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- With
Statuses []string - List only servers with the specified status, could contain
initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- id number
- ID of the server.
- name string
- Name of the server.
- networks list(object)
- (map) Private Network the server is attached to.
- placement_
group_ numberid - (Optional, string) Placement Group ID the server is assigned to.
- selector string
- with_
selector string - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with_
statuses list(string) - List only servers with the specified status, could contain
initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- id Integer
- ID of the server.
- name String
- Name of the server.
- networks
List<Get
Server Network> - (map) Private Network the server is attached to.
- placement
Group IntegerId - (Optional, string) Placement Group ID the server is assigned to.
- selector String
- with
Selector String - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with
Statuses List<String> - List only servers with the specified status, could contain
initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- id number
- ID of the server.
- name string
- Name of the server.
- networks
Get
Server Network[] - (map) Private Network the server is attached to.
- placement
Group numberId - (Optional, string) Placement Group ID the server is assigned to.
- selector string
- with
Selector string - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with
Statuses string[] - List only servers with the specified status, could contain
initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- id int
- ID of the server.
- name str
- Name of the server.
- networks
Sequence[Get
Server Network] - (map) Private Network the server is attached to.
- placement_
group_ intid - (Optional, string) Placement Group ID the server is assigned to.
- selector str
- with_
selector str - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with_
statuses Sequence[str] - List only servers with the specified status, could contain
initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
- id Number
- ID of the server.
- name String
- Name of the server.
- networks List<Property Map>
- (map) Private Network the server is attached to.
- placement
Group NumberId - (Optional, string) Placement Group ID the server is assigned to.
- selector String
- with
Selector String - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with
Statuses List<String> - List only servers with the specified status, could contain
initializing,starting,running,stopping,off,deleting,rebuilding,migrating,unknown.
getServer Result
The following output properties are available:
- Backup
Window string - (string) The backup window of the server, if enabled.
- Backups bool
- (bool) Whether backups are enabled.
- Datacenter string
- (string, deprecated) The datacenter name. See the Hetzner Docs for more details about datacenters.
- Delete
Protection bool - (bool) Whether delete protection is enabled.
- Firewall
Ids List<int> - (Optional, list) Firewall IDs the server is attached to.
- Id int
- (int) Unique ID of the server.
- Image string
- (string) Name or ID of the image the server was created from.
- Ipv4Address string
- (string) The IPv4 address.
- Ipv6Address string
- (string) The first IPv6 address of the assigned network.
- Ipv6Network string
- (string) The IPv6 network.
- Iso string
- (string) ID or Name of the mounted ISO image. Architecture of ISO must equal the server (type) architecture.
- Labels Dictionary<string, string>
- (map) User-defined labels (key-value pairs)
- Location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- Name string
- (string) Name of the server.
- Primary
Disk intSize - (int) The size of the primary disk in GB.
- Rebuild
Protection bool - (bool) Whether rebuild protection is enabled.
- Rescue string
- Server
Type string - (string) Name of the server type.
- Status string
- (string) The status of the server.
- Networks
List<Pulumi.
HCloud. Outputs. Get Server Network> - (map) Private Network the server is attached to.
- Placement
Group intId - (Optional, string) Placement Group ID the server is assigned to.
- Selector string
- With
Selector string - With
Statuses List<string>
- Backup
Window string - (string) The backup window of the server, if enabled.
- Backups bool
- (bool) Whether backups are enabled.
- Datacenter string
- (string, deprecated) The datacenter name. See the Hetzner Docs for more details about datacenters.
- Delete
Protection bool - (bool) Whether delete protection is enabled.
- Firewall
Ids []int - (Optional, list) Firewall IDs the server is attached to.
- Id int
- (int) Unique ID of the server.
- Image string
- (string) Name or ID of the image the server was created from.
- Ipv4Address string
- (string) The IPv4 address.
- Ipv6Address string
- (string) The first IPv6 address of the assigned network.
- Ipv6Network string
- (string) The IPv6 network.
- Iso string
- (string) ID or Name of the mounted ISO image. Architecture of ISO must equal the server (type) architecture.
- Labels map[string]string
- (map) User-defined labels (key-value pairs)
- Location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- Name string
- (string) Name of the server.
- Primary
Disk intSize - (int) The size of the primary disk in GB.
- Rebuild
Protection bool - (bool) Whether rebuild protection is enabled.
- Rescue string
- Server
Type string - (string) Name of the server type.
- Status string
- (string) The status of the server.
- Networks
[]Get
Server Network Type - (map) Private Network the server is attached to.
- Placement
Group intId - (Optional, string) Placement Group ID the server is assigned to.
- Selector string
- With
Selector string - With
Statuses []string
- backup_
window string - (string) The backup window of the server, if enabled.
- backups bool
- (bool) Whether backups are enabled.
- datacenter string
- (string, deprecated) The datacenter name. See the Hetzner Docs for more details about datacenters.
- delete_
protection bool - (bool) Whether delete protection is enabled.
- firewall_
ids list(number) - (Optional, list) Firewall IDs the server is attached to.
- id number
- (int) Unique ID of the server.
- image string
- (string) Name or ID of the image the server was created from.
- ipv4_
address string - (string) The IPv4 address.
- ipv6_
address string - (string) The first IPv6 address of the assigned network.
- ipv6_
network string - (string) The IPv6 network.
- iso string
- (string) ID or Name of the mounted ISO image. Architecture of ISO must equal the server (type) architecture.
- labels map(string)
- (map) User-defined labels (key-value pairs)
- location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- name string
- (string) Name of the server.
- primary_
disk_ numbersize - (int) The size of the primary disk in GB.
- rebuild_
protection bool - (bool) Whether rebuild protection is enabled.
- rescue string
- server_
type string - (string) Name of the server type.
- status string
- (string) The status of the server.
- networks list(object)
- (map) Private Network the server is attached to.
- placement_
group_ numberid - (Optional, string) Placement Group ID the server is assigned to.
- selector string
- with_
selector string - with_
statuses list(string)
- backup
Window String - (string) The backup window of the server, if enabled.
- backups Boolean
- (bool) Whether backups are enabled.
- datacenter String
- (string, deprecated) The datacenter name. See the Hetzner Docs for more details about datacenters.
- delete
Protection Boolean - (bool) Whether delete protection is enabled.
- firewall
Ids List<Integer> - (Optional, list) Firewall IDs the server is attached to.
- id Integer
- (int) Unique ID of the server.
- image String
- (string) Name or ID of the image the server was created from.
- ipv4Address String
- (string) The IPv4 address.
- ipv6Address String
- (string) The first IPv6 address of the assigned network.
- ipv6Network String
- (string) The IPv6 network.
- iso String
- (string) ID or Name of the mounted ISO image. Architecture of ISO must equal the server (type) architecture.
- labels Map<String,String>
- (map) User-defined labels (key-value pairs)
- location String
- (string) The location name. See the Hetzner Docs for more details about locations.
- name String
- (string) Name of the server.
- primary
Disk IntegerSize - (int) The size of the primary disk in GB.
- rebuild
Protection Boolean - (bool) Whether rebuild protection is enabled.
- rescue String
- server
Type String - (string) Name of the server type.
- status String
- (string) The status of the server.
- networks
List<Get
Server Network> - (map) Private Network the server is attached to.
- placement
Group IntegerId - (Optional, string) Placement Group ID the server is assigned to.
- selector String
- with
Selector String - with
Statuses List<String>
- backup
Window string - (string) The backup window of the server, if enabled.
- backups boolean
- (bool) Whether backups are enabled.
- datacenter string
- (string, deprecated) The datacenter name. See the Hetzner Docs for more details about datacenters.
- delete
Protection boolean - (bool) Whether delete protection is enabled.
- firewall
Ids number[] - (Optional, list) Firewall IDs the server is attached to.
- id number
- (int) Unique ID of the server.
- image string
- (string) Name or ID of the image the server was created from.
- ipv4Address string
- (string) The IPv4 address.
- ipv6Address string
- (string) The first IPv6 address of the assigned network.
- ipv6Network string
- (string) The IPv6 network.
- iso string
- (string) ID or Name of the mounted ISO image. Architecture of ISO must equal the server (type) architecture.
- labels {[key: string]: string}
- (map) User-defined labels (key-value pairs)
- location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- name string
- (string) Name of the server.
- primary
Disk numberSize - (int) The size of the primary disk in GB.
- rebuild
Protection boolean - (bool) Whether rebuild protection is enabled.
- rescue string
- server
Type string - (string) Name of the server type.
- status string
- (string) The status of the server.
- networks
Get
Server Network[] - (map) Private Network the server is attached to.
- placement
Group numberId - (Optional, string) Placement Group ID the server is assigned to.
- selector string
- with
Selector string - with
Statuses string[]
- backup_
window str - (string) The backup window of the server, if enabled.
- backups bool
- (bool) Whether backups are enabled.
- datacenter str
- (string, deprecated) The datacenter name. See the Hetzner Docs for more details about datacenters.
- delete_
protection bool - (bool) Whether delete protection is enabled.
- firewall_
ids Sequence[int] - (Optional, list) Firewall IDs the server is attached to.
- id int
- (int) Unique ID of the server.
- image str
- (string) Name or ID of the image the server was created from.
- ipv4_
address str - (string) The IPv4 address.
- ipv6_
address str - (string) The first IPv6 address of the assigned network.
- ipv6_
network str - (string) The IPv6 network.
- iso str
- (string) ID or Name of the mounted ISO image. Architecture of ISO must equal the server (type) architecture.
- labels Mapping[str, str]
- (map) User-defined labels (key-value pairs)
- location str
- (string) The location name. See the Hetzner Docs for more details about locations.
- name str
- (string) Name of the server.
- primary_
disk_ intsize - (int) The size of the primary disk in GB.
- rebuild_
protection bool - (bool) Whether rebuild protection is enabled.
- rescue str
- server_
type str - (string) Name of the server type.
- status str
- (string) The status of the server.
- networks
Sequence[Get
Server Network] - (map) Private Network the server is attached to.
- placement_
group_ intid - (Optional, string) Placement Group ID the server is assigned to.
- selector str
- with_
selector str - with_
statuses Sequence[str]
- backup
Window String - (string) The backup window of the server, if enabled.
- backups Boolean
- (bool) Whether backups are enabled.
- datacenter String
- (string, deprecated) The datacenter name. See the Hetzner Docs for more details about datacenters.
- delete
Protection Boolean - (bool) Whether delete protection is enabled.
- firewall
Ids List<Number> - (Optional, list) Firewall IDs the server is attached to.
- id Number
- (int) Unique ID of the server.
- image String
- (string) Name or ID of the image the server was created from.
- ipv4Address String
- (string) The IPv4 address.
- ipv6Address String
- (string) The first IPv6 address of the assigned network.
- ipv6Network String
- (string) The IPv6 network.
- iso String
- (string) ID or Name of the mounted ISO image. Architecture of ISO must equal the server (type) architecture.
- labels Map<String>
- (map) User-defined labels (key-value pairs)
- location String
- (string) The location name. See the Hetzner Docs for more details about locations.
- name String
- (string) Name of the server.
- primary
Disk NumberSize - (int) The size of the primary disk in GB.
- rebuild
Protection Boolean - (bool) Whether rebuild protection is enabled.
- rescue String
- server
Type String - (string) Name of the server type.
- status String
- (string) The status of the server.
- networks List<Property Map>
- (map) Private Network the server is attached to.
- placement
Group NumberId - (Optional, string) Placement Group ID the server is assigned to.
- selector String
- with
Selector String - with
Statuses List<String>
Supporting Types
GetServerNetwork
- Alias
Ips List<string> - (list) A list of alias IP addresses assigned to the server in the network.
- Ip string
- (string) The server's IP address within the network.
- Mac
Address string - (string) The MAC address associated with the server's private network interface.
- Network
Id int - (int) The unique identifier for the network.
- Alias
Ips []string - (list) A list of alias IP addresses assigned to the server in the network.
- Ip string
- (string) The server's IP address within the network.
- Mac
Address string - (string) The MAC address associated with the server's private network interface.
- Network
Id int - (int) The unique identifier for the network.
- alias_
ips list(string) - (list) A list of alias IP addresses assigned to the server in the network.
- ip string
- (string) The server's IP address within the network.
- mac_
address string - (string) The MAC address associated with the server's private network interface.
- network_
id number - (int) The unique identifier for the network.
- alias
Ips List<String> - (list) A list of alias IP addresses assigned to the server in the network.
- ip String
- (string) The server's IP address within the network.
- mac
Address String - (string) The MAC address associated with the server's private network interface.
- network
Id Integer - (int) The unique identifier for the network.
- alias
Ips string[] - (list) A list of alias IP addresses assigned to the server in the network.
- ip string
- (string) The server's IP address within the network.
- mac
Address string - (string) The MAC address associated with the server's private network interface.
- network
Id number - (int) The unique identifier for the network.
- alias_
ips Sequence[str] - (list) A list of alias IP addresses assigned to the server in the network.
- ip str
- (string) The server's IP address within the network.
- mac_
address str - (string) The MAC address associated with the server's private network interface.
- network_
id int - (int) The unique identifier for the network.
- alias
Ips List<String> - (list) A list of alias IP addresses assigned to the server in the network.
- ip String
- (string) The server's IP address within the network.
- mac
Address String - (string) The MAC address associated with the server's private network interface.
- network
Id Number - (int) The unique identifier for the network.
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloudTerraform Provider.
Viewing docs for Hetzner Cloud v1.41.0
published on Wednesday, Jul 29, 2026 by Pulumi
published on Wednesday, Jul 29, 2026 by Pulumi