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,
}],
});
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,
}])
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
})
}
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,
},
},
});
});
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());
}
}
resources:
# Create a new server running debian
node1:
type: hcloud:Server
properties:
name: node1
image: debian-11
serverType: cx22
publicNets:
- ipv4Enabled: true
ipv6Enabled: true
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,
}],
});
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,
}])
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
})
}
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,
},
},
});
});
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());
}
}
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
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],
});
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]))
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
}
_, 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
})
}
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,
},
});
});
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());
}
}
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"]}
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,
}],
});
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,
}])
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
})
}
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,
},
},
});
});
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());
}
}
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
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,
shutdown_before_deletion: Optional[bool] = 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,
name: Optional[str] = None,
user_data: Optional[str] = None,
datacenter: Optional[str] = None,
keep_disk: Optional[bool] = None,
networks: Optional[Sequence[ServerNetworkArgs]] = None,
placement_group_id: Optional[int] = None,
public_nets: Optional[Sequence[ServerPublicNetArgs]] = None,
rebuild_protection: Optional[bool] = None,
rescue: Optional[str] = None,
backups: Optional[bool] = None,
allow_deprecated_images: Optional[bool] = None,
ssh_keys: Optional[Sequence[str]] = None,
labels: Optional[Mapping[str, 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 string
- The unique name of the resource.
- args ServerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args 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 string
- The unique name of the resource.
- args ServerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
ShutdownBeforeDeletion = false,
DeleteProtection = false,
FirewallIds = new[]
{
0,
},
IgnoreRemoteFirewallIds = false,
Image = "string",
Iso = "string",
Name = "string",
UserData = "string",
Datacenter = "string",
KeepDisk = false,
Networks = new[]
{
new HCloud.Inputs.ServerNetworkArgs
{
NetworkId = 0,
AliasIps = new[]
{
"string",
},
Ip = "string",
MacAddress = "string",
},
},
PlacementGroupId = 0,
PublicNets = new[]
{
new HCloud.Inputs.ServerPublicNetArgs
{
Ipv4 = 0,
Ipv4Enabled = false,
Ipv6 = 0,
Ipv6Enabled = false,
},
},
RebuildProtection = false,
Rescue = "string",
Backups = false,
AllowDeprecatedImages = false,
SshKeys = new[]
{
"string",
},
Labels =
{
{ "string", "string" },
},
});
example, err := hcloud.NewServer(ctx, "serverResource", &hcloud.ServerArgs{
ServerType: pulumi.String("string"),
Location: pulumi.String("string"),
ShutdownBeforeDeletion: pulumi.Bool(false),
DeleteProtection: pulumi.Bool(false),
FirewallIds: pulumi.IntArray{
pulumi.Int(0),
},
IgnoreRemoteFirewallIds: pulumi.Bool(false),
Image: pulumi.String("string"),
Iso: pulumi.String("string"),
Name: pulumi.String("string"),
UserData: pulumi.String("string"),
Datacenter: pulumi.String("string"),
KeepDisk: pulumi.Bool(false),
Networks: hcloud.ServerNetworkTypeArray{
&hcloud.ServerNetworkTypeArgs{
NetworkId: pulumi.Int(0),
AliasIps: pulumi.StringArray{
pulumi.String("string"),
},
Ip: pulumi.String("string"),
MacAddress: pulumi.String("string"),
},
},
PlacementGroupId: pulumi.Int(0),
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),
AllowDeprecatedImages: pulumi.Bool(false),
SshKeys: pulumi.StringArray{
pulumi.String("string"),
},
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var serverResource = new Server("serverResource", ServerArgs.builder()
.serverType("string")
.location("string")
.shutdownBeforeDeletion(false)
.deleteProtection(false)
.firewallIds(0)
.ignoreRemoteFirewallIds(false)
.image("string")
.iso("string")
.name("string")
.userData("string")
.datacenter("string")
.keepDisk(false)
.networks(ServerNetworkArgs.builder()
.networkId(0)
.aliasIps("string")
.ip("string")
.macAddress("string")
.build())
.placementGroupId(0)
.publicNets(ServerPublicNetArgs.builder()
.ipv4(0)
.ipv4Enabled(false)
.ipv6(0)
.ipv6Enabled(false)
.build())
.rebuildProtection(false)
.rescue("string")
.backups(false)
.allowDeprecatedImages(false)
.sshKeys("string")
.labels(Map.of("string", "string"))
.build());
server_resource = hcloud.Server("serverResource",
server_type="string",
location="string",
shutdown_before_deletion=False,
delete_protection=False,
firewall_ids=[0],
ignore_remote_firewall_ids=False,
image="string",
iso="string",
name="string",
user_data="string",
datacenter="string",
keep_disk=False,
networks=[{
"network_id": 0,
"alias_ips": ["string"],
"ip": "string",
"mac_address": "string",
}],
placement_group_id=0,
public_nets=[{
"ipv4": 0,
"ipv4_enabled": False,
"ipv6": 0,
"ipv6_enabled": False,
}],
rebuild_protection=False,
rescue="string",
backups=False,
allow_deprecated_images=False,
ssh_keys=["string"],
labels={
"string": "string",
})
const serverResource = new hcloud.Server("serverResource", {
serverType: "string",
location: "string",
shutdownBeforeDeletion: false,
deleteProtection: false,
firewallIds: [0],
ignoreRemoteFirewallIds: false,
image: "string",
iso: "string",
name: "string",
userData: "string",
datacenter: "string",
keepDisk: false,
networks: [{
networkId: 0,
aliasIps: ["string"],
ip: "string",
macAddress: "string",
}],
placementGroupId: 0,
publicNets: [{
ipv4: 0,
ipv4Enabled: false,
ipv6: 0,
ipv6Enabled: false,
}],
rebuildProtection: false,
rescue: "string",
backups: false,
allowDeprecatedImages: false,
sshKeys: ["string"],
labels: {
string: "string",
},
});
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
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:
- Server
Type string - Name of the server type this server should be created with.
- Allow
Deprecated boolImages - 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 string
- 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 List<int> - Firewall IDs the server should be attached to on creation.
- Ignore
Remote boolFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - Image string
- Iso string
- 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 Dictionary<string, string>
- User-defined labels (key-value pairs) should be created with.
- Location 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. Server Network> - Network the server should be attached to on creation. (Can be specified multiple times)
- Placement
Group intId - Placement Group ID the server added to on creation.
- Public
Nets List<Pulumi.HCloud. Inputs. Server Public Net> - 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 string
- Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems.
linux64
orlinux32
- Shutdown
Before boolDeletion - Whether to try shutting the server down gracefully before deleting it.
- Ssh
Keys 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 ]
. - User
Data string - Cloud-Init user data to use during server creation
- Server
Type string - Name of the server type this server should be created with.
- Allow
Deprecated boolImages - 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 string
- 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 []int - Firewall IDs the server should be attached to on creation.
- Ignore
Remote boolFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - Image string
- Iso string
- 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 map[string]string
- User-defined labels (key-value pairs) should be created with.
- Location 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
[]Server
Network Type Args - Network the server should be attached to on creation. (Can be specified multiple times)
- Placement
Group intId - Placement Group ID the server added to on creation.
- Public
Nets []ServerPublic Net Args - 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 string
- Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems.
linux64
orlinux32
- Shutdown
Before boolDeletion - Whether to try shutting the server down gracefully before deleting it.
- Ssh
Keys []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 ]
. - User
Data string - Cloud-Init user data to use during server creation
- server
Type String - Name of the server type this server should be created with.
- allow
Deprecated BooleanImages - 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 String
- The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
- delete
Protection Boolean - Enable or disable delete protection (Needs to be the same as
rebuild_protection
). See "Delete Protection" in the Provider Docs for details. - firewall
Ids List<Integer> - Firewall IDs the server should be attached to on creation.
- ignore
Remote BooleanFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - image String
- iso String
- ID or Name of an ISO image to mount.
- keep
Disk 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 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<Server
Network> - Network the server should be attached to on creation. (Can be specified multiple times)
- placement
Group IntegerId - Placement Group ID the server added to on creation.
- public
Nets List<ServerPublic Net> - 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 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
orlinux32
- shutdown
Before BooleanDeletion - Whether to try shutting the server down gracefully before deleting it.
- ssh
Keys 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 ]
. - user
Data String - Cloud-Init user data to use during server creation
- server
Type string - Name of the server type this server should be created with.
- allow
Deprecated booleanImages - 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 string
- The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
- delete
Protection boolean - Enable or disable delete protection (Needs to be the same as
rebuild_protection
). See "Delete Protection" in the Provider Docs for details. - firewall
Ids number[] - Firewall IDs the server should be attached to on creation.
- ignore
Remote booleanFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - image string
- iso string
- ID or Name of an ISO image to mount.
- keep
Disk 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 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
Server
Network[] - Network the server should be attached to on creation. (Can be specified multiple times)
- placement
Group numberId - Placement Group ID the server added to on creation.
- public
Nets ServerPublic Net[] - 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 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
orlinux32
- shutdown
Before booleanDeletion - Whether to try shutting the server down gracefully before deleting it.
- ssh
Keys 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 ]
. - user
Data string - Cloud-Init user data to use during server creation
- server_
type str - Name of the server type this server should be created with.
- allow_
deprecated_ boolimages - 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 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_ boolfirewall_ ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - image 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 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[Server
Network Args] - Network the server should be attached to on creation. (Can be specified multiple times)
- placement_
group_ intid - Placement Group ID the server added to on creation.
- public_
nets Sequence[ServerPublic Net Args] - 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
orlinux32
- shutdown_
before_ booldeletion - Whether to try shutting the server down gracefully before deleting it.
- ssh_
keys 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 str - Cloud-Init user data to use during server creation
- server
Type String - Name of the server type this server should be created with.
- allow
Deprecated BooleanImages - 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 String
- The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
- delete
Protection Boolean - Enable or disable delete protection (Needs to be the same as
rebuild_protection
). See "Delete Protection" in the Provider Docs for details. - firewall
Ids List<Number> - Firewall IDs the server should be attached to on creation.
- ignore
Remote BooleanFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - image String
- iso String
- ID or Name of an ISO image to mount.
- keep
Disk 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 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)
- placement
Group NumberId - Placement Group ID the server added to on creation.
- public
Nets 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.
- rebuild
Protection 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
orlinux32
- shutdown
Before BooleanDeletion - Whether to try shutting the server down gracefully before deleting it.
- ssh
Keys 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 ]
. - user
Data 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:
- Backup
Window string - (string) The backup window of the server, if enabled.
- 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.
- Primary
Disk intSize - (int) The size of the primary disk in GB.
- Status string
- (string) The status of the server.
- Backup
Window string - (string) The backup window of the server, if enabled.
- 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.
- Primary
Disk intSize - (int) The size of the primary disk in GB.
- Status string
- (string) The status of the server.
- backup
Window String - (string) The backup window of the server, if enabled.
- 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.
- primary
Disk IntegerSize - (int) The size of the primary disk in GB.
- status String
- (string) The status of the server.
- backup
Window string - (string) The backup window of the server, if enabled.
- 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.
- primary
Disk numberSize - (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.
- 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_ intsize - (int) The size of the primary disk in GB.
- status str
- (string) The status of the server.
- backup
Window String - (string) The backup window of the server, if enabled.
- 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.
- primary
Disk NumberSize - (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)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Allow
Deprecated boolImages - 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 string - (string) The backup window of the server, if enabled.
- Backups bool
- Enable or disable backups.
- Datacenter string
- 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 List<int> - Firewall IDs the server should be attached to on creation.
- Ignore
Remote boolFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - Image 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.
- Keep
Disk 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 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. Server Network> - Network the server should be attached to on creation. (Can be specified multiple times)
- Placement
Group intId - Placement Group ID the server added to on creation.
- Primary
Disk intSize - (int) The size of the primary disk in GB.
- Public
Nets List<Pulumi.HCloud. Inputs. Server Public Net> - 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 string
- Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems.
linux64
orlinux32
- Server
Type string - Name of the server type this server should be created with.
- Shutdown
Before boolDeletion - Whether to try shutting the server down gracefully before deleting it.
- Ssh
Keys 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.
- User
Data string - Cloud-Init user data to use during server creation
- Allow
Deprecated boolImages - 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 string - (string) The backup window of the server, if enabled.
- Backups bool
- Enable or disable backups.
- Datacenter string
- 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 []int - Firewall IDs the server should be attached to on creation.
- Ignore
Remote boolFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - Image 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.
- Keep
Disk 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 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
[]Server
Network Type Args - Network the server should be attached to on creation. (Can be specified multiple times)
- Placement
Group intId - Placement Group ID the server added to on creation.
- Primary
Disk intSize - (int) The size of the primary disk in GB.
- Public
Nets []ServerPublic Net Args - 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 string
- Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems.
linux64
orlinux32
- Server
Type string - Name of the server type this server should be created with.
- Shutdown
Before boolDeletion - Whether to try shutting the server down gracefully before deleting it.
- Ssh
Keys []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.
- User
Data string - Cloud-Init user data to use during server creation
- allow
Deprecated BooleanImages - 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 String - (string) The backup window of the server, if enabled.
- backups Boolean
- Enable or disable backups.
- datacenter String
- The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
- delete
Protection Boolean - Enable or disable delete protection (Needs to be the same as
rebuild_protection
). See "Delete Protection" in the Provider Docs for details. - firewall
Ids List<Integer> - Firewall IDs the server should be attached to on creation.
- ignore
Remote BooleanFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - image 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.
- keep
Disk 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 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<Server
Network> - Network the server should be attached to on creation. (Can be specified multiple times)
- placement
Group IntegerId - Placement Group ID the server added to on creation.
- primary
Disk IntegerSize - (int) The size of the primary disk in GB.
- public
Nets List<ServerPublic Net> - 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 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
orlinux32
- server
Type String - Name of the server type this server should be created with.
- shutdown
Before BooleanDeletion - Whether to try shutting the server down gracefully before deleting it.
- ssh
Keys 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.
- user
Data String - Cloud-Init user data to use during server creation
- allow
Deprecated booleanImages - 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 string - (string) The backup window of the server, if enabled.
- backups boolean
- Enable or disable backups.
- datacenter string
- The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
- delete
Protection boolean - Enable or disable delete protection (Needs to be the same as
rebuild_protection
). See "Delete Protection" in the Provider Docs for details. - firewall
Ids number[] - Firewall IDs the server should be attached to on creation.
- ignore
Remote booleanFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - image 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.
- keep
Disk 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 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
Server
Network[] - Network the server should be attached to on creation. (Can be specified multiple times)
- placement
Group numberId - Placement Group ID the server added to on creation.
- primary
Disk numberSize - (int) The size of the primary disk in GB.
- public
Nets ServerPublic Net[] - 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 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
orlinux32
- server
Type string - Name of the server type this server should be created with.
- shutdown
Before booleanDeletion - Whether to try shutting the server down gracefully before deleting it.
- ssh
Keys 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.
- user
Data string - Cloud-Init user data to use during server creation
- allow_
deprecated_ boolimages - 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.
- backups bool
- Enable or disable backups.
- datacenter 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_ boolfirewall_ ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - image 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 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[Server
Network Args] - Network the server should be attached to on creation. (Can be specified multiple times)
- placement_
group_ intid - Placement Group ID the server added to on creation.
- primary_
disk_ intsize - (int) The size of the primary disk in GB.
- public_
nets Sequence[ServerPublic Net Args] - 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
orlinux32
- server_
type str - Name of the server type this server should be created with.
- shutdown_
before_ booldeletion - Whether to try shutting the server down gracefully before deleting it.
- ssh_
keys 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 str - Cloud-Init user data to use during server creation
- allow
Deprecated BooleanImages - 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 String - (string) The backup window of the server, if enabled.
- backups Boolean
- Enable or disable backups.
- datacenter String
- The datacenter name to create the server in. See the Hetzner Docs for more details about datacenters.
- delete
Protection Boolean - Enable or disable delete protection (Needs to be the same as
rebuild_protection
). See "Delete Protection" in the Provider Docs for details. - firewall
Ids List<Number> - Firewall IDs the server should be attached to on creation.
- ignore
Remote BooleanFirewall Ids - 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 thehcloud.FirewallAttachment
resource for a reason to use this argument. - image 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.
- keep
Disk 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 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)
- placement
Group NumberId - Placement Group ID the server added to on creation.
- primary
Disk NumberSize - (int) The size of the primary disk in GB.
- public
Nets 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.
- rebuild
Protection 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
orlinux32
- server
Type String - Name of the server type this server should be created with.
- shutdown
Before BooleanDeletion - Whether to try shutting the server down gracefully before deleting it.
- ssh
Keys 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.
- user
Data String - Cloud-Init user data to use during server creation
Supporting Types
ServerNetwork, ServerNetworkArgs
- Network
Id int - ID of the network
- Alias
Ips List<string> - Ip string
- Specify the IP the server should get in the network
- Mac
Address string - (Optional, string) The MAC address the private interface of the server has
- Network
Id int - ID of the network
- Alias
Ips []string - Ip string
- Specify the IP the server should get in the network
- Mac
Address string - (Optional, string) The MAC address the private interface of the server has
- network
Id Integer - ID of the network
- alias
Ips List<String> - ip String
- Specify the IP the server should get in the network
- mac
Address String - (Optional, string) The MAC address the private interface of the server has
- network
Id number - ID of the network
- alias
Ips string[] - ip string
- Specify the IP the server should get in the network
- mac
Address string - (Optional, string) The MAC address the private interface of the server has
- network_
id 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
- network
Id Number - ID of the network
- alias
Ips List<String> - ip String
- Specify the IP the server should get in the network
- mac
Address String - (Optional, string) The MAC address the private interface of the server has
ServerPublicNet, ServerPublicNetArgs
- Ipv4 int
- Ipv4Enabled bool
- Ipv6 int
- Ipv6Enabled bool
- Ipv4 int
- Ipv4Enabled bool
- Ipv6 int
- Ipv6Enabled bool
- ipv4 Integer
- ipv4Enabled Boolean
- ipv6 Integer
- ipv6Enabled Boolean
- ipv4 number
- ipv4Enabled boolean
- ipv6 number
- ipv6Enabled boolean
- ipv4 int
- ipv4_
enabled bool - ipv6 int
- ipv6_
enabled bool
- ipv4 Number
- ipv4Enabled Boolean
- ipv6 Number
- ipv6Enabled Boolean
Import
Servers can be imported using the server id
:
$ pulumi import hcloud:index/server:Server myserver id
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.