1. Packages
  2. Hcloud Provider
  3. API Docs
  4. Server
Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi

hcloud.Server

Explore with Pulumi AI

Provides an Hetzner Cloud server resource. This can be used to create, modify, and delete servers. Servers also support provisioning.

Example Usage

Basic server creation

import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

// Create a new server running debian
const node1 = new hcloud.Server("node1", {
    name: "node1",
    image: "debian-11",
    serverType: "cx22",
    publicNets: [{
        ipv4Enabled: true,
        ipv6Enabled: true,
    }],
});
Copy
import pulumi
import pulumi_hcloud as hcloud

# Create a new server running debian
node1 = hcloud.Server("node1",
    name="node1",
    image="debian-11",
    server_type="cx22",
    public_nets=[{
        "ipv4_enabled": True,
        "ipv6_enabled": True,
    }])
Copy
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 {
		// Create a new server running debian
		_, err := hcloud.NewServer(ctx, "node1", &hcloud.ServerArgs{
			Name:       pulumi.String("node1"),
			Image:      pulumi.String("debian-11"),
			ServerType: pulumi.String("cx22"),
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv6Enabled: pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    // Create a new server running debian
    var node1 = new HCloud.Server("node1", new()
    {
        Name = "node1",
        Image = "debian-11",
        ServerType = "cx22",
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv6Enabled = true,
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.Server;
import com.pulumi.hcloud.ServerArgs;
import com.pulumi.hcloud.inputs.ServerPublicNetArgs;
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) {
        // Create a new server running debian
        var node1 = new Server("node1", ServerArgs.builder()
            .name("node1")
            .image("debian-11")
            .serverType("cx22")
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv6Enabled(true)
                .build())
            .build());

    }
}
Copy
resources:
  # Create a new server running debian
  node1:
    type: hcloud:Server
    properties:
      name: node1
      image: debian-11
      serverType: cx22
      publicNets:
        - ipv4Enabled: true
          ipv6Enabled: true
Copy
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

//## Server creation with one linked primary ip (ipv4)
const primaryIp1 = new hcloud.PrimaryIp("primary_ip_1", {
    name: "primary_ip_test",
    datacenter: "fsn1-dc14",
    type: "ipv4",
    assigneeType: "server",
    autoDelete: true,
    labels: {
        hallo: "welt",
    },
});
const serverTest = new hcloud.Server("server_test", {
    name: "test-server",
    image: "ubuntu-20.04",
    serverType: "cx22",
    datacenter: "fsn1-dc14",
    labels: {
        test: "tessst1",
    },
    publicNets: [{
        ipv4Enabled: true,
        ipv4: primaryIp1.id,
        ipv6Enabled: false,
    }],
});
Copy
import pulumi
import pulumi_hcloud as hcloud

### Server creation with one linked primary ip (ipv4)
primary_ip1 = hcloud.PrimaryIp("primary_ip_1",
    name="primary_ip_test",
    datacenter="fsn1-dc14",
    type="ipv4",
    assignee_type="server",
    auto_delete=True,
    labels={
        "hallo": "welt",
    })
server_test = hcloud.Server("server_test",
    name="test-server",
    image="ubuntu-20.04",
    server_type="cx22",
    datacenter="fsn1-dc14",
    labels={
        "test": "tessst1",
    },
    public_nets=[{
        "ipv4_enabled": True,
        "ipv4": primary_ip1.id,
        "ipv6_enabled": False,
    }])
Copy
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 {
		// ## Server creation with one linked primary ip (ipv4)
		primaryIp1, err := hcloud.NewPrimaryIp(ctx, "primary_ip_1", &hcloud.PrimaryIpArgs{
			Name:         pulumi.String("primary_ip_test"),
			Datacenter:   pulumi.String("fsn1-dc14"),
			Type:         pulumi.String("ipv4"),
			AssigneeType: pulumi.String("server"),
			AutoDelete:   pulumi.Bool(true),
			Labels: pulumi.StringMap{
				"hallo": pulumi.String("welt"),
			},
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewServer(ctx, "server_test", &hcloud.ServerArgs{
			Name:       pulumi.String("test-server"),
			Image:      pulumi.String("ubuntu-20.04"),
			ServerType: pulumi.String("cx22"),
			Datacenter: pulumi.String("fsn1-dc14"),
			Labels: pulumi.StringMap{
				"test": pulumi.String("tessst1"),
			},
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv4:        primaryIp1.ID(),
					Ipv6Enabled: pulumi.Bool(false),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    //## Server creation with one linked primary ip (ipv4)
    var primaryIp1 = new HCloud.PrimaryIp("primary_ip_1", new()
    {
        Name = "primary_ip_test",
        Datacenter = "fsn1-dc14",
        Type = "ipv4",
        AssigneeType = "server",
        AutoDelete = true,
        Labels = 
        {
            { "hallo", "welt" },
        },
    });

    var serverTest = new HCloud.Server("server_test", new()
    {
        Name = "test-server",
        Image = "ubuntu-20.04",
        ServerType = "cx22",
        Datacenter = "fsn1-dc14",
        Labels = 
        {
            { "test", "tessst1" },
        },
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv4 = primaryIp1.Id,
                Ipv6Enabled = false,
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.PrimaryIp;
import com.pulumi.hcloud.PrimaryIpArgs;
import com.pulumi.hcloud.Server;
import com.pulumi.hcloud.ServerArgs;
import com.pulumi.hcloud.inputs.ServerPublicNetArgs;
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) {
        //## Server creation with one linked primary ip (ipv4)
        var primaryIp1 = new PrimaryIp("primaryIp1", PrimaryIpArgs.builder()
            .name("primary_ip_test")
            .datacenter("fsn1-dc14")
            .type("ipv4")
            .assigneeType("server")
            .autoDelete(true)
            .labels(Map.of("hallo", "welt"))
            .build());

        var serverTest = new Server("serverTest", ServerArgs.builder()
            .name("test-server")
            .image("ubuntu-20.04")
            .serverType("cx22")
            .datacenter("fsn1-dc14")
            .labels(Map.of("test", "tessst1"))
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv4(primaryIp1.id())
                .ipv6Enabled(false)
                .build())
            .build());

    }
}
Copy
resources:
  ### Server creation with one linked primary ip (ipv4)
  primaryIp1:
    type: hcloud:PrimaryIp
    name: primary_ip_1
    properties:
      name: primary_ip_test
      datacenter: fsn1-dc14
      type: ipv4
      assigneeType: server
      autoDelete: true
      labels:
        hallo: welt
  serverTest:
    type: hcloud:Server
    name: server_test
    properties:
      name: test-server
      image: ubuntu-20.04
      serverType: cx22
      datacenter: fsn1-dc14
      labels:
        test: tessst1
      publicNets:
        - ipv4Enabled: true
          ipv4: ${primaryIp1.id}
          ipv6Enabled: false
Copy

Server creation with network

import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const network = new hcloud.Network("network", {
    name: "network",
    ipRange: "10.0.0.0/16",
});
const network_subnet = new hcloud.NetworkSubnet("network-subnet", {
    type: "cloud",
    networkId: network.id,
    networkZone: "eu-central",
    ipRange: "10.0.1.0/24",
});
const server = new hcloud.Server("server", {
    name: "server",
    serverType: "cx22",
    image: "ubuntu-20.04",
    location: "nbg1",
    networks: [{
        networkId: network.id,
        ip: "10.0.1.5",
        aliasIps: [
            "10.0.1.6",
            "10.0.1.7",
        ],
    }],
}, {
    dependsOn: [network_subnet],
});
Copy
import pulumi
import pulumi_hcloud as hcloud

network = hcloud.Network("network",
    name="network",
    ip_range="10.0.0.0/16")
network_subnet = hcloud.NetworkSubnet("network-subnet",
    type="cloud",
    network_id=network.id,
    network_zone="eu-central",
    ip_range="10.0.1.0/24")
server = hcloud.Server("server",
    name="server",
    server_type="cx22",
    image="ubuntu-20.04",
    location="nbg1",
    networks=[{
        "network_id": network.id,
        "ip": "10.0.1.5",
        "alias_ips": [
            "10.0.1.6",
            "10.0.1.7",
        ],
    }],
    opts = pulumi.ResourceOptions(depends_on=[network_subnet]))
Copy
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 {
		network, err := hcloud.NewNetwork(ctx, "network", &hcloud.NetworkArgs{
			Name:    pulumi.String("network"),
			IpRange: pulumi.String("10.0.0.0/16"),
		})
		if err != nil {
			return err
		}
		network_subnet, err := hcloud.NewNetworkSubnet(ctx, "network-subnet", &hcloud.NetworkSubnetArgs{
			Type:        pulumi.String("cloud"),
			NetworkId:   network.ID(),
			NetworkZone: pulumi.String("eu-central"),
			IpRange:     pulumi.String("10.0.1.0/24"),
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewServer(ctx, "server", &hcloud.ServerArgs{
			Name:       pulumi.String("server"),
			ServerType: pulumi.String("cx22"),
			Image:      pulumi.String("ubuntu-20.04"),
			Location:   pulumi.String("nbg1"),
			Networks: hcloud.ServerNetworkTypeArray{
				&hcloud.ServerNetworkTypeArgs{
					NetworkId: network.ID(),
					Ip:        pulumi.String("10.0.1.5"),
					AliasIps: pulumi.StringArray{
						pulumi.String("10.0.1.6"),
						pulumi.String("10.0.1.7"),
					},
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			network_subnet,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    var network = new HCloud.Network("network", new()
    {
        Name = "network",
        IpRange = "10.0.0.0/16",
    });

    var network_subnet = new HCloud.NetworkSubnet("network-subnet", new()
    {
        Type = "cloud",
        NetworkId = network.Id,
        NetworkZone = "eu-central",
        IpRange = "10.0.1.0/24",
    });

    var server = new HCloud.Server("server", new()
    {
        Name = "server",
        ServerType = "cx22",
        Image = "ubuntu-20.04",
        Location = "nbg1",
        Networks = new[]
        {
            new HCloud.Inputs.ServerNetworkArgs
            {
                NetworkId = network.Id,
                Ip = "10.0.1.5",
                AliasIps = new[]
                {
                    "10.0.1.6",
                    "10.0.1.7",
                },
            },
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            network_subnet,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.Network;
import com.pulumi.hcloud.NetworkArgs;
import com.pulumi.hcloud.NetworkSubnet;
import com.pulumi.hcloud.NetworkSubnetArgs;
import com.pulumi.hcloud.Server;
import com.pulumi.hcloud.ServerArgs;
import com.pulumi.hcloud.inputs.ServerNetworkArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
        var network = new Network("network", NetworkArgs.builder()
            .name("network")
            .ipRange("10.0.0.0/16")
            .build());

        var network_subnet = new NetworkSubnet("network-subnet", NetworkSubnetArgs.builder()
            .type("cloud")
            .networkId(network.id())
            .networkZone("eu-central")
            .ipRange("10.0.1.0/24")
            .build());

        var server = new Server("server", ServerArgs.builder()
            .name("server")
            .serverType("cx22")
            .image("ubuntu-20.04")
            .location("nbg1")
            .networks(ServerNetworkArgs.builder()
                .networkId(network.id())
                .ip("10.0.1.5")
                .aliasIps(                
                    "10.0.1.6",
                    "10.0.1.7")
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(network_subnet)
                .build());

    }
}
Copy
resources:
  network:
    type: hcloud:Network
    properties:
      name: network
      ipRange: 10.0.0.0/16
  network-subnet:
    type: hcloud:NetworkSubnet
    properties:
      type: cloud
      networkId: ${network.id}
      networkZone: eu-central
      ipRange: 10.0.1.0/24
  server:
    type: hcloud:Server
    properties:
      name: server
      serverType: cx22
      image: ubuntu-20.04
      location: nbg1
      networks:
        - networkId: ${network.id}
          ip: 10.0.1.5
          aliasIps:
            - 10.0.1.6
            - 10.0.1.7
    options:
      dependsOn:
        - ${["network-subnet"]}
Copy

Server creation from snapshot

import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

// Get image infos because we need the ID
const packerSnapshot = hcloud.getImage({
    withSelector: "app=foobar",
    mostRecent: true,
});
// Create a new server from the snapshot
const fromSnapshot = new hcloud.Server("from_snapshot", {
    name: "from-snapshot",
    image: packerSnapshot.then(packerSnapshot => packerSnapshot.id),
    serverType: "cx22",
    publicNets: [{
        ipv4Enabled: true,
        ipv6Enabled: true,
    }],
});
Copy
import pulumi
import pulumi_hcloud as hcloud

# Get image infos because we need the ID
packer_snapshot = hcloud.get_image(with_selector="app=foobar",
    most_recent=True)
# Create a new server from the snapshot
from_snapshot = hcloud.Server("from_snapshot",
    name="from-snapshot",
    image=packer_snapshot.id,
    server_type="cx22",
    public_nets=[{
        "ipv4_enabled": True,
        "ipv6_enabled": True,
    }])
Copy
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 {
		// Get image infos because we need the ID
		packerSnapshot, err := hcloud.GetImage(ctx, &hcloud.GetImageArgs{
			WithSelector: pulumi.StringRef("app=foobar"),
			MostRecent:   pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		// Create a new server from the snapshot
		_, err = hcloud.NewServer(ctx, "from_snapshot", &hcloud.ServerArgs{
			Name:       pulumi.String("from-snapshot"),
			Image:      pulumi.Int(packerSnapshot.Id),
			ServerType: pulumi.String("cx22"),
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv6Enabled: pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    // Get image infos because we need the ID
    var packerSnapshot = HCloud.GetImage.Invoke(new()
    {
        WithSelector = "app=foobar",
        MostRecent = true,
    });

    // Create a new server from the snapshot
    var fromSnapshot = new HCloud.Server("from_snapshot", new()
    {
        Name = "from-snapshot",
        Image = packerSnapshot.Apply(getImageResult => getImageResult.Id),
        ServerType = "cx22",
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv6Enabled = true,
            },
        },
    });

});
Copy
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.GetImageArgs;
import com.pulumi.hcloud.Server;
import com.pulumi.hcloud.ServerArgs;
import com.pulumi.hcloud.inputs.ServerPublicNetArgs;
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) {
        // Get image infos because we need the ID
        final var packerSnapshot = HcloudFunctions.getImage(GetImageArgs.builder()
            .withSelector("app=foobar")
            .mostRecent(true)
            .build());

        // Create a new server from the snapshot
        var fromSnapshot = new Server("fromSnapshot", ServerArgs.builder()
            .name("from-snapshot")
            .image(packerSnapshot.applyValue(getImageResult -> getImageResult.id()))
            .serverType("cx22")
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv6Enabled(true)
                .build())
            .build());

    }
}
Copy
resources:
  # Create a new server from the snapshot
  fromSnapshot:
    type: hcloud:Server
    name: from_snapshot
    properties:
      name: from-snapshot
      image: ${packerSnapshot.id}
      serverType: cx22
      publicNets:
        - ipv4Enabled: true
          ipv6Enabled: true
variables:
  # Get image infos because we need the ID
  packerSnapshot:
    fn::invoke:
      function: hcloud:getImage
      arguments:
        withSelector: app=foobar
        mostRecent: true
Copy

Primary IPs

When creating a server without linking at least one ´primary_ip´, it automatically creates & assigns two (ipv4 & ipv6). With the public_net block, you can enable or link primary ips. If you don’t define this block, two primary ips (ipv4, ipv6) will be created and assigned to the server automatically.

Create Server Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Server(name: string, args: ServerArgs, opts?: CustomResourceOptions);
@overload
def Server(resource_name: str,
           args: ServerArgs,
           opts: Optional[ResourceOptions] = None)

@overload
def Server(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           server_type: Optional[str] = None,
           location: Optional[str] = None,
           datacenter: Optional[str] = None,
           delete_protection: Optional[bool] = None,
           firewall_ids: Optional[Sequence[int]] = None,
           ignore_remote_firewall_ids: Optional[bool] = None,
           image: Optional[str] = None,
           iso: Optional[str] = None,
           keep_disk: Optional[bool] = None,
           allow_deprecated_images: Optional[bool] = None,
           labels: Optional[Mapping[str, str]] = None,
           placement_group_id: Optional[int] = None,
           networks: Optional[Sequence[ServerNetworkArgs]] = None,
           name: Optional[str] = None,
           public_nets: Optional[Sequence[ServerPublicNetArgs]] = None,
           rebuild_protection: Optional[bool] = None,
           rescue: Optional[str] = None,
           backups: Optional[bool] = None,
           shutdown_before_deletion: Optional[bool] = None,
           ssh_keys: Optional[Sequence[str]] = None,
           user_data: Optional[str] = None)
func NewServer(ctx *Context, name string, args ServerArgs, opts ...ResourceOption) (*Server, error)
public Server(string name, ServerArgs args, CustomResourceOptions? opts = null)
public Server(String name, ServerArgs args)
public Server(String name, ServerArgs args, CustomResourceOptions options)
type: hcloud:Server
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ServerArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ServerArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ServerArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ServerArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ServerArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var serverResource = new HCloud.Server("serverResource", new()
{
    ServerType = "string",
    Location = "string",
    Datacenter = "string",
    DeleteProtection = false,
    FirewallIds = new[]
    {
        0,
    },
    IgnoreRemoteFirewallIds = false,
    Image = "string",
    Iso = "string",
    KeepDisk = false,
    AllowDeprecatedImages = false,
    Labels = 
    {
        { "string", "string" },
    },
    PlacementGroupId = 0,
    Networks = new[]
    {
        new HCloud.Inputs.ServerNetworkArgs
        {
            NetworkId = 0,
            AliasIps = new[]
            {
                "string",
            },
            Ip = "string",
            MacAddress = "string",
        },
    },
    Name = "string",
    PublicNets = new[]
    {
        new HCloud.Inputs.ServerPublicNetArgs
        {
            Ipv4 = 0,
            Ipv4Enabled = false,
            Ipv6 = 0,
            Ipv6Enabled = false,
        },
    },
    RebuildProtection = false,
    Rescue = "string",
    Backups = false,
    ShutdownBeforeDeletion = false,
    SshKeys = new[]
    {
        "string",
    },
    UserData = "string",
});
Copy
example, err := hcloud.NewServer(ctx, "serverResource", &hcloud.ServerArgs{
	ServerType:       pulumi.String("string"),
	Location:         pulumi.String("string"),
	Datacenter:       pulumi.String("string"),
	DeleteProtection: pulumi.Bool(false),
	FirewallIds: pulumi.IntArray{
		pulumi.Int(0),
	},
	IgnoreRemoteFirewallIds: pulumi.Bool(false),
	Image:                   pulumi.String("string"),
	Iso:                     pulumi.String("string"),
	KeepDisk:                pulumi.Bool(false),
	AllowDeprecatedImages:   pulumi.Bool(false),
	Labels: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	PlacementGroupId: pulumi.Int(0),
	Networks: hcloud.ServerNetworkTypeArray{
		&hcloud.ServerNetworkTypeArgs{
			NetworkId: pulumi.Int(0),
			AliasIps: pulumi.StringArray{
				pulumi.String("string"),
			},
			Ip:         pulumi.String("string"),
			MacAddress: pulumi.String("string"),
		},
	},
	Name: pulumi.String("string"),
	PublicNets: hcloud.ServerPublicNetArray{
		&hcloud.ServerPublicNetArgs{
			Ipv4:        pulumi.Int(0),
			Ipv4Enabled: pulumi.Bool(false),
			Ipv6:        pulumi.Int(0),
			Ipv6Enabled: pulumi.Bool(false),
		},
	},
	RebuildProtection:      pulumi.Bool(false),
	Rescue:                 pulumi.String("string"),
	Backups:                pulumi.Bool(false),
	ShutdownBeforeDeletion: pulumi.Bool(false),
	SshKeys: pulumi.StringArray{
		pulumi.String("string"),
	},
	UserData: pulumi.String("string"),
})
Copy
var serverResource = new Server("serverResource", ServerArgs.builder()
    .serverType("string")
    .location("string")
    .datacenter("string")
    .deleteProtection(false)
    .firewallIds(0)
    .ignoreRemoteFirewallIds(false)
    .image("string")
    .iso("string")
    .keepDisk(false)
    .allowDeprecatedImages(false)
    .labels(Map.of("string", "string"))
    .placementGroupId(0)
    .networks(ServerNetworkArgs.builder()
        .networkId(0)
        .aliasIps("string")
        .ip("string")
        .macAddress("string")
        .build())
    .name("string")
    .publicNets(ServerPublicNetArgs.builder()
        .ipv4(0)
        .ipv4Enabled(false)
        .ipv6(0)
        .ipv6Enabled(false)
        .build())
    .rebuildProtection(false)
    .rescue("string")
    .backups(false)
    .shutdownBeforeDeletion(false)
    .sshKeys("string")
    .userData("string")
    .build());
Copy
server_resource = hcloud.Server("serverResource",
    server_type="string",
    location="string",
    datacenter="string",
    delete_protection=False,
    firewall_ids=[0],
    ignore_remote_firewall_ids=False,
    image="string",
    iso="string",
    keep_disk=False,
    allow_deprecated_images=False,
    labels={
        "string": "string",
    },
    placement_group_id=0,
    networks=[{
        "network_id": 0,
        "alias_ips": ["string"],
        "ip": "string",
        "mac_address": "string",
    }],
    name="string",
    public_nets=[{
        "ipv4": 0,
        "ipv4_enabled": False,
        "ipv6": 0,
        "ipv6_enabled": False,
    }],
    rebuild_protection=False,
    rescue="string",
    backups=False,
    shutdown_before_deletion=False,
    ssh_keys=["string"],
    user_data="string")
Copy
const serverResource = new hcloud.Server("serverResource", {
    serverType: "string",
    location: "string",
    datacenter: "string",
    deleteProtection: false,
    firewallIds: [0],
    ignoreRemoteFirewallIds: false,
    image: "string",
    iso: "string",
    keepDisk: false,
    allowDeprecatedImages: false,
    labels: {
        string: "string",
    },
    placementGroupId: 0,
    networks: [{
        networkId: 0,
        aliasIps: ["string"],
        ip: "string",
        macAddress: "string",
    }],
    name: "string",
    publicNets: [{
        ipv4: 0,
        ipv4Enabled: false,
        ipv6: 0,
        ipv6Enabled: false,
    }],
    rebuildProtection: false,
    rescue: "string",
    backups: false,
    shutdownBeforeDeletion: false,
    sshKeys: ["string"],
    userData: "string",
});
Copy
type: hcloud:Server
properties:
    allowDeprecatedImages: false
    backups: false
    datacenter: string
    deleteProtection: false
    firewallIds:
        - 0
    ignoreRemoteFirewallIds: false
    image: string
    iso: string
    keepDisk: false
    labels:
        string: string
    location: string
    name: string
    networks:
        - aliasIps:
            - string
          ip: string
          macAddress: string
          networkId: 0
    placementGroupId: 0
    publicNets:
        - ipv4: 0
          ipv4Enabled: false
          ipv6: 0
          ipv6Enabled: false
    rebuildProtection: false
    rescue: string
    serverType: string
    shutdownBeforeDeletion: false
    sshKeys:
        - string
    userData: string
Copy

Server Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Server resource accepts the following input properties:

ServerType This property is required. string
Name of the server type this server should be created with.
AllowDeprecatedImages bool
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
Backups bool
Enable or disable backups.
Datacenter Changes to this property will trigger replacement. string
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
DeleteProtection bool
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
FirewallIds List<int>
Firewall IDs the server should be attached to on creation.
IgnoreRemoteFirewallIds bool
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
Image Changes to this property will trigger replacement. string
Iso string
ID or Name of an ISO image to mount.
KeepDisk bool
If true, do not upgrade the disk. This allows downgrading the server type later.
Labels Dictionary<string, string>
User-defined labels (key-value pairs) should be created with.
Location Changes to this property will trigger replacement. string
The location name to create the server in. See the Hetzner Docs for more details about locations.
Name string
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
Networks List<Pulumi.HCloud.Inputs.ServerNetwork>
Network the server should be attached to on creation. (Can be specified multiple times)
PlacementGroupId int
Placement Group ID the server added to on creation.
PublicNets List<Pulumi.HCloud.Inputs.ServerPublicNet>
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
RebuildProtection bool
Enable or disable rebuild protection (Needs to be the same as delete_protection).
Rescue string
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
ShutdownBeforeDeletion bool
Whether to try shutting the server down gracefully before deleting it.
SshKeys Changes to this property will trigger replacement. List<string>
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
UserData Changes to this property will trigger replacement. string
Cloud-Init user data to use during server creation
ServerType This property is required. string
Name of the server type this server should be created with.
AllowDeprecatedImages bool
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
Backups bool
Enable or disable backups.
Datacenter Changes to this property will trigger replacement. string
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
DeleteProtection bool
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
FirewallIds []int
Firewall IDs the server should be attached to on creation.
IgnoreRemoteFirewallIds bool
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
Image Changes to this property will trigger replacement. string
Iso string
ID or Name of an ISO image to mount.
KeepDisk bool
If true, do not upgrade the disk. This allows downgrading the server type later.
Labels map[string]string
User-defined labels (key-value pairs) should be created with.
Location Changes to this property will trigger replacement. string
The location name to create the server in. See the Hetzner Docs for more details about locations.
Name string
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
Networks []ServerNetworkTypeArgs
Network the server should be attached to on creation. (Can be specified multiple times)
PlacementGroupId int
Placement Group ID the server added to on creation.
PublicNets []ServerPublicNetArgs
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
RebuildProtection bool
Enable or disable rebuild protection (Needs to be the same as delete_protection).
Rescue string
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
ShutdownBeforeDeletion bool
Whether to try shutting the server down gracefully before deleting it.
SshKeys Changes to this property will trigger replacement. []string
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
UserData Changes to this property will trigger replacement. string
Cloud-Init user data to use during server creation
serverType This property is required. String
Name of the server type this server should be created with.
allowDeprecatedImages Boolean
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
backups Boolean
Enable or disable backups.
datacenter Changes to this property will trigger replacement. String
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
deleteProtection Boolean
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
firewallIds List<Integer>
Firewall IDs the server should be attached to on creation.
ignoreRemoteFirewallIds Boolean
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
image Changes to this property will trigger replacement. String
iso String
ID or Name of an ISO image to mount.
keepDisk Boolean
If true, do not upgrade the disk. This allows downgrading the server type later.
labels Map<String,String>
User-defined labels (key-value pairs) should be created with.
location Changes to this property will trigger replacement. String
The location name to create the server in. See the Hetzner Docs for more details about locations.
name String
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
networks List<ServerNetwork>
Network the server should be attached to on creation. (Can be specified multiple times)
placementGroupId Integer
Placement Group ID the server added to on creation.
publicNets List<ServerPublicNet>
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
rebuildProtection Boolean
Enable or disable rebuild protection (Needs to be the same as delete_protection).
rescue String
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
shutdownBeforeDeletion Boolean
Whether to try shutting the server down gracefully before deleting it.
sshKeys Changes to this property will trigger replacement. List<String>
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
userData Changes to this property will trigger replacement. String
Cloud-Init user data to use during server creation
serverType This property is required. string
Name of the server type this server should be created with.
allowDeprecatedImages boolean
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
backups boolean
Enable or disable backups.
datacenter Changes to this property will trigger replacement. string
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
deleteProtection boolean
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
firewallIds number[]
Firewall IDs the server should be attached to on creation.
ignoreRemoteFirewallIds boolean
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
image Changes to this property will trigger replacement. string
iso string
ID or Name of an ISO image to mount.
keepDisk boolean
If true, do not upgrade the disk. This allows downgrading the server type later.
labels {[key: string]: string}
User-defined labels (key-value pairs) should be created with.
location Changes to this property will trigger replacement. string
The location name to create the server in. See the Hetzner Docs for more details about locations.
name string
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
networks ServerNetwork[]
Network the server should be attached to on creation. (Can be specified multiple times)
placementGroupId number
Placement Group ID the server added to on creation.
publicNets ServerPublicNet[]
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
rebuildProtection boolean
Enable or disable rebuild protection (Needs to be the same as delete_protection).
rescue string
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
shutdownBeforeDeletion boolean
Whether to try shutting the server down gracefully before deleting it.
sshKeys Changes to this property will trigger replacement. string[]
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
userData Changes to this property will trigger replacement. string
Cloud-Init user data to use during server creation
server_type This property is required. str
Name of the server type this server should be created with.
allow_deprecated_images bool
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
backups bool
Enable or disable backups.
datacenter Changes to this property will trigger replacement. str
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
delete_protection bool
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
firewall_ids Sequence[int]
Firewall IDs the server should be attached to on creation.
ignore_remote_firewall_ids bool
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
image Changes to this property will trigger replacement. str
iso str
ID or Name of an ISO image to mount.
keep_disk bool
If true, do not upgrade the disk. This allows downgrading the server type later.
labels Mapping[str, str]
User-defined labels (key-value pairs) should be created with.
location Changes to this property will trigger replacement. str
The location name to create the server in. See the Hetzner Docs for more details about locations.
name str
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
networks Sequence[ServerNetworkArgs]
Network the server should be attached to on creation. (Can be specified multiple times)
placement_group_id int
Placement Group ID the server added to on creation.
public_nets Sequence[ServerPublicNetArgs]
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
rebuild_protection bool
Enable or disable rebuild protection (Needs to be the same as delete_protection).
rescue str
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
shutdown_before_deletion bool
Whether to try shutting the server down gracefully before deleting it.
ssh_keys Changes to this property will trigger replacement. Sequence[str]
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
user_data Changes to this property will trigger replacement. str
Cloud-Init user data to use during server creation
serverType This property is required. String
Name of the server type this server should be created with.
allowDeprecatedImages Boolean
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
backups Boolean
Enable or disable backups.
datacenter Changes to this property will trigger replacement. String
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
deleteProtection Boolean
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
firewallIds List<Number>
Firewall IDs the server should be attached to on creation.
ignoreRemoteFirewallIds Boolean
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
image Changes to this property will trigger replacement. String
iso String
ID or Name of an ISO image to mount.
keepDisk Boolean
If true, do not upgrade the disk. This allows downgrading the server type later.
labels Map<String>
User-defined labels (key-value pairs) should be created with.
location Changes to this property will trigger replacement. String
The location name to create the server in. See the Hetzner Docs for more details about locations.
name String
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
networks List<Property Map>
Network the server should be attached to on creation. (Can be specified multiple times)
placementGroupId Number
Placement Group ID the server added to on creation.
publicNets List<Property Map>
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
rebuildProtection Boolean
Enable or disable rebuild protection (Needs to be the same as delete_protection).
rescue String
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
shutdownBeforeDeletion Boolean
Whether to try shutting the server down gracefully before deleting it.
sshKeys Changes to this property will trigger replacement. List<String>
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
userData Changes to this property will trigger replacement. String
Cloud-Init user data to use during server creation

Outputs

All input properties are implicitly available as output properties. Additionally, the Server resource produces the following output properties:

BackupWindow string
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

Id string
The provider-assigned unique ID for this managed resource.
Ipv4Address string
(string) The IPv4 address.
Ipv6Address string
(string) The first IPv6 address of the assigned network.
Ipv6Network string
(string) The IPv6 network.
PrimaryDiskSize int
(int) The size of the primary disk in GB.
Status string
(string) The status of the server.
BackupWindow string
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

Id string
The provider-assigned unique ID for this managed resource.
Ipv4Address string
(string) The IPv4 address.
Ipv6Address string
(string) The first IPv6 address of the assigned network.
Ipv6Network string
(string) The IPv6 network.
PrimaryDiskSize int
(int) The size of the primary disk in GB.
Status string
(string) The status of the server.
backupWindow String
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

id String
The provider-assigned unique ID for this managed resource.
ipv4Address String
(string) The IPv4 address.
ipv6Address String
(string) The first IPv6 address of the assigned network.
ipv6Network String
(string) The IPv6 network.
primaryDiskSize Integer
(int) The size of the primary disk in GB.
status String
(string) The status of the server.
backupWindow string
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

id string
The provider-assigned unique ID for this managed resource.
ipv4Address string
(string) The IPv4 address.
ipv6Address string
(string) The first IPv6 address of the assigned network.
ipv6Network string
(string) The IPv6 network.
primaryDiskSize number
(int) The size of the primary disk in GB.
status string
(string) The status of the server.
backup_window str
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

id str
The provider-assigned unique ID for this managed resource.
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.
primary_disk_size int
(int) The size of the primary disk in GB.
status str
(string) The status of the server.
backupWindow String
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

id String
The provider-assigned unique ID for this managed resource.
ipv4Address String
(string) The IPv4 address.
ipv6Address String
(string) The first IPv6 address of the assigned network.
ipv6Network String
(string) The IPv6 network.
primaryDiskSize Number
(int) The size of the primary disk in GB.
status String
(string) The status of the server.

Look up Existing Server Resource

Get an existing Server resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ServerState, opts?: CustomResourceOptions): Server
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allow_deprecated_images: Optional[bool] = None,
        backup_window: Optional[str] = None,
        backups: Optional[bool] = None,
        datacenter: Optional[str] = None,
        delete_protection: Optional[bool] = None,
        firewall_ids: Optional[Sequence[int]] = None,
        ignore_remote_firewall_ids: Optional[bool] = None,
        image: Optional[str] = None,
        ipv4_address: Optional[str] = None,
        ipv6_address: Optional[str] = None,
        ipv6_network: Optional[str] = None,
        iso: Optional[str] = None,
        keep_disk: Optional[bool] = None,
        labels: Optional[Mapping[str, str]] = None,
        location: Optional[str] = None,
        name: Optional[str] = None,
        networks: Optional[Sequence[ServerNetworkArgs]] = None,
        placement_group_id: Optional[int] = None,
        primary_disk_size: Optional[int] = None,
        public_nets: Optional[Sequence[ServerPublicNetArgs]] = None,
        rebuild_protection: Optional[bool] = None,
        rescue: Optional[str] = None,
        server_type: Optional[str] = None,
        shutdown_before_deletion: Optional[bool] = None,
        ssh_keys: Optional[Sequence[str]] = None,
        status: Optional[str] = None,
        user_data: Optional[str] = None) -> Server
func GetServer(ctx *Context, name string, id IDInput, state *ServerState, opts ...ResourceOption) (*Server, error)
public static Server Get(string name, Input<string> id, ServerState? state, CustomResourceOptions? opts = null)
public static Server get(String name, Output<String> id, ServerState state, CustomResourceOptions options)
resources:  _:    type: hcloud:Server    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AllowDeprecatedImages bool
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
BackupWindow string
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

Backups bool
Enable or disable backups.
Datacenter Changes to this property will trigger replacement. string
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
DeleteProtection bool
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
FirewallIds List<int>
Firewall IDs the server should be attached to on creation.
IgnoreRemoteFirewallIds bool
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
Image Changes to this property will trigger replacement. string
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
ID or Name of an ISO image to mount.
KeepDisk bool
If true, do not upgrade the disk. This allows downgrading the server type later.
Labels Dictionary<string, string>
User-defined labels (key-value pairs) should be created with.
Location Changes to this property will trigger replacement. string
The location name to create the server in. See the Hetzner Docs for more details about locations.
Name string
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
Networks List<Pulumi.HCloud.Inputs.ServerNetwork>
Network the server should be attached to on creation. (Can be specified multiple times)
PlacementGroupId int
Placement Group ID the server added to on creation.
PrimaryDiskSize int
(int) The size of the primary disk in GB.
PublicNets List<Pulumi.HCloud.Inputs.ServerPublicNet>
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
RebuildProtection bool
Enable or disable rebuild protection (Needs to be the same as delete_protection).
Rescue string
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
ServerType string
Name of the server type this server should be created with.
ShutdownBeforeDeletion bool
Whether to try shutting the server down gracefully before deleting it.
SshKeys Changes to this property will trigger replacement. List<string>
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
Status string
(string) The status of the server.
UserData Changes to this property will trigger replacement. string
Cloud-Init user data to use during server creation
AllowDeprecatedImages bool
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
BackupWindow string
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

Backups bool
Enable or disable backups.
Datacenter Changes to this property will trigger replacement. string
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
DeleteProtection bool
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
FirewallIds []int
Firewall IDs the server should be attached to on creation.
IgnoreRemoteFirewallIds bool
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
Image Changes to this property will trigger replacement. string
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
ID or Name of an ISO image to mount.
KeepDisk bool
If true, do not upgrade the disk. This allows downgrading the server type later.
Labels map[string]string
User-defined labels (key-value pairs) should be created with.
Location Changes to this property will trigger replacement. string
The location name to create the server in. See the Hetzner Docs for more details about locations.
Name string
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
Networks []ServerNetworkTypeArgs
Network the server should be attached to on creation. (Can be specified multiple times)
PlacementGroupId int
Placement Group ID the server added to on creation.
PrimaryDiskSize int
(int) The size of the primary disk in GB.
PublicNets []ServerPublicNetArgs
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
RebuildProtection bool
Enable or disable rebuild protection (Needs to be the same as delete_protection).
Rescue string
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
ServerType string
Name of the server type this server should be created with.
ShutdownBeforeDeletion bool
Whether to try shutting the server down gracefully before deleting it.
SshKeys Changes to this property will trigger replacement. []string
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
Status string
(string) The status of the server.
UserData Changes to this property will trigger replacement. string
Cloud-Init user data to use during server creation
allowDeprecatedImages Boolean
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
backupWindow String
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

backups Boolean
Enable or disable backups.
datacenter Changes to this property will trigger replacement. String
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
deleteProtection Boolean
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
firewallIds List<Integer>
Firewall IDs the server should be attached to on creation.
ignoreRemoteFirewallIds Boolean
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
image Changes to this property will trigger replacement. String
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
ID or Name of an ISO image to mount.
keepDisk Boolean
If true, do not upgrade the disk. This allows downgrading the server type later.
labels Map<String,String>
User-defined labels (key-value pairs) should be created with.
location Changes to this property will trigger replacement. String
The location name to create the server in. See the Hetzner Docs for more details about locations.
name String
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
networks List<ServerNetwork>
Network the server should be attached to on creation. (Can be specified multiple times)
placementGroupId Integer
Placement Group ID the server added to on creation.
primaryDiskSize Integer
(int) The size of the primary disk in GB.
publicNets List<ServerPublicNet>
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
rebuildProtection Boolean
Enable or disable rebuild protection (Needs to be the same as delete_protection).
rescue String
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
serverType String
Name of the server type this server should be created with.
shutdownBeforeDeletion Boolean
Whether to try shutting the server down gracefully before deleting it.
sshKeys Changes to this property will trigger replacement. List<String>
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
status String
(string) The status of the server.
userData Changes to this property will trigger replacement. String
Cloud-Init user data to use during server creation
allowDeprecatedImages boolean
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
backupWindow string
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

backups boolean
Enable or disable backups.
datacenter Changes to this property will trigger replacement. string
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
deleteProtection boolean
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
firewallIds number[]
Firewall IDs the server should be attached to on creation.
ignoreRemoteFirewallIds boolean
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
image Changes to this property will trigger replacement. string
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
ID or Name of an ISO image to mount.
keepDisk boolean
If true, do not upgrade the disk. This allows downgrading the server type later.
labels {[key: string]: string}
User-defined labels (key-value pairs) should be created with.
location Changes to this property will trigger replacement. string
The location name to create the server in. See the Hetzner Docs for more details about locations.
name string
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
networks ServerNetwork[]
Network the server should be attached to on creation. (Can be specified multiple times)
placementGroupId number
Placement Group ID the server added to on creation.
primaryDiskSize number
(int) The size of the primary disk in GB.
publicNets ServerPublicNet[]
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
rebuildProtection boolean
Enable or disable rebuild protection (Needs to be the same as delete_protection).
rescue string
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
serverType string
Name of the server type this server should be created with.
shutdownBeforeDeletion boolean
Whether to try shutting the server down gracefully before deleting it.
sshKeys Changes to this property will trigger replacement. string[]
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
status string
(string) The status of the server.
userData Changes to this property will trigger replacement. string
Cloud-Init user data to use during server creation
allow_deprecated_images bool
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
backup_window str
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

backups bool
Enable or disable backups.
datacenter Changes to this property will trigger replacement. str
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
delete_protection bool
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
firewall_ids Sequence[int]
Firewall IDs the server should be attached to on creation.
ignore_remote_firewall_ids bool
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
image Changes to this property will trigger replacement. str
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
ID or Name of an ISO image to mount.
keep_disk bool
If true, do not upgrade the disk. This allows downgrading the server type later.
labels Mapping[str, str]
User-defined labels (key-value pairs) should be created with.
location Changes to this property will trigger replacement. str
The location name to create the server in. See the Hetzner Docs for more details about locations.
name str
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
networks Sequence[ServerNetworkArgs]
Network the server should be attached to on creation. (Can be specified multiple times)
placement_group_id int
Placement Group ID the server added to on creation.
primary_disk_size int
(int) The size of the primary disk in GB.
public_nets Sequence[ServerPublicNetArgs]
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
rebuild_protection bool
Enable or disable rebuild protection (Needs to be the same as delete_protection).
rescue str
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
server_type str
Name of the server type this server should be created with.
shutdown_before_deletion bool
Whether to try shutting the server down gracefully before deleting it.
ssh_keys Changes to this property will trigger replacement. Sequence[str]
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
status str
(string) The status of the server.
user_data Changes to this property will trigger replacement. str
Cloud-Init user data to use during server creation
allowDeprecatedImages Boolean
Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible.
backupWindow String
(string) The backup window of the server, if enabled.

Deprecated: You should remove this property from your terraform configuration.

backups Boolean
Enable or disable backups.
datacenter Changes to this property will trigger replacement. String
The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
deleteProtection Boolean
Enable or disable delete protection (Needs to be the same as rebuild_protection). See "Delete Protection" in the Provider Docs for details.
firewallIds List<Number>
Firewall IDs the server should be attached to on creation.
ignoreRemoteFirewallIds Boolean
Ignores any updates to the firewall_ids argument which were received from the server. This should not be used in normal cases. See the documentation of the hcloud.FirewallAttachment resource for a reason to use this argument.
image Changes to this property will trigger replacement. String
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
ID or Name of an ISO image to mount.
keepDisk Boolean
If true, do not upgrade the disk. This allows downgrading the server type later.
labels Map<String>
User-defined labels (key-value pairs) should be created with.
location Changes to this property will trigger replacement. String
The location name to create the server in. See the Hetzner Docs for more details about locations.
name String
Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).
networks List<Property Map>
Network the server should be attached to on creation. (Can be specified multiple times)
placementGroupId Number
Placement Group ID the server added to on creation.
primaryDiskSize Number
(int) The size of the primary disk in GB.
publicNets List<Property Map>
In this block you can either enable / disable ipv4 and ipv6 or link existing primary IPs (checkout the examples). If this block is not defined, two primary (ipv4 & ipv6) ips getting auto generated.
rebuildProtection Boolean
Enable or disable rebuild protection (Needs to be the same as delete_protection).
rescue String
Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32
serverType String
Name of the server type this server should be created with.
shutdownBeforeDeletion Boolean
Whether to try shutting the server down gracefully before deleting it.
sshKeys Changes to this property will trigger replacement. List<String>
SSH key IDs or names which should be injected into the server at creation time. Once the server is created, you can not update the list of SSH Keys. If you do change this, you will be prompted to destroy and recreate the server. You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ].
status String
(string) The status of the server.
userData Changes to this property will trigger replacement. String
Cloud-Init user data to use during server creation

Supporting Types

ServerNetwork
, ServerNetworkArgs

NetworkId This property is required. int
ID of the network
AliasIps List<string>
Ip string
Specify the IP the server should get in the network
MacAddress string
(Optional, string) The MAC address the private interface of the server has
NetworkId This property is required. int
ID of the network
AliasIps []string
Ip string
Specify the IP the server should get in the network
MacAddress string
(Optional, string) The MAC address the private interface of the server has
networkId This property is required. Integer
ID of the network
aliasIps List<String>
ip String
Specify the IP the server should get in the network
macAddress String
(Optional, string) The MAC address the private interface of the server has
networkId This property is required. number
ID of the network
aliasIps string[]
ip string
Specify the IP the server should get in the network
macAddress string
(Optional, string) The MAC address the private interface of the server has
network_id This property is required. int
ID of the network
alias_ips Sequence[str]
ip str
Specify the IP the server should get in the network
mac_address str
(Optional, string) The MAC address the private interface of the server has
networkId This property is required. Number
ID of the network
aliasIps List<String>
ip String
Specify the IP the server should get in the network
macAddress String
(Optional, string) The MAC address the private interface of the server has

ServerPublicNet
, ServerPublicNetArgs

ipv4 Integer
ipv4Enabled Boolean
ipv6 Integer
ipv6Enabled Boolean
ipv4 number
ipv4Enabled boolean
ipv6 number
ipv6Enabled boolean
ipv4 Number
ipv4Enabled Boolean
ipv6 Number
ipv6Enabled Boolean

Import

Servers can be imported using the server id:

$ pulumi import hcloud:index/server:Server example "$SERVER_ID"
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Hetzner Cloud pulumi/pulumi-hcloud
License
Apache-2.0
Notes
This Pulumi package is based on the hcloud Terraform Provider.