hcloud logo
Hetzner Cloud v1.10.3, Mar 8 23

hcloud.Server

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.

Examples

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

// Assign existing ipv4 only
const serverTestServer = new hcloud.Server("serverTestServer", {publicNets: [{
    ipv4Enabled: true,
    ipv4: hcloud_primary_ip.primary_ip_1.id,
    ipv6Enabled: false,
}]});
//...
// Link a managed ipv4 but autogenerate ipv6
const serverTestIndex_serverServer = new hcloud.Server("serverTestIndex/serverServer", {publicNets: [{
    ipv4Enabled: true,
    ipv4: hcloud_primary_ip.primary_ip_1.id,
    ipv6Enabled: false,
}]});
//...
// Assign & create auto-generated ipv4 & ipv6
const serverTestHcloudIndex_serverServer = new hcloud.Server("serverTestHcloudIndex/serverServer", {publicNets: [{
    ipv4Enabled: true,
    ipv6Enabled: true,
}]});
//...
import pulumi
import pulumi_hcloud as hcloud

# Assign existing ipv4 only
server_test_server = hcloud.Server("serverTestServer", public_nets=[hcloud.ServerPublicNetArgs(
    ipv4_enabled=True,
    ipv4=hcloud_primary_ip["primary_ip_1"]["id"],
    ipv6_enabled=False,
)])
#...
# Link a managed ipv4 but autogenerate ipv6
server_test_index_server_server = hcloud.Server("serverTestIndex/serverServer", public_nets=[hcloud.ServerPublicNetArgs(
    ipv4_enabled=True,
    ipv4=hcloud_primary_ip["primary_ip_1"]["id"],
    ipv6_enabled=False,
)])
#...
# Assign & create auto-generated ipv4 & ipv6
server_test_hcloud_index_server_server = hcloud.Server("serverTestHcloudIndex/serverServer", public_nets=[hcloud.ServerPublicNetArgs(
    ipv4_enabled=True,
    ipv6_enabled=True,
)])
#...
using System.Collections.Generic;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    // Assign existing ipv4 only
    var serverTestServer = new HCloud.Server("serverTestServer", new()
    {
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv4 = hcloud_primary_ip.Primary_ip_1.Id,
                Ipv6Enabled = false,
            },
        },
    });

    //...
    // Link a managed ipv4 but autogenerate ipv6
    var serverTestIndex_serverServer = new HCloud.Server("serverTestIndex/serverServer", new()
    {
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv4 = hcloud_primary_ip.Primary_ip_1.Id,
                Ipv6Enabled = false,
            },
        },
    });

    //...
    // Assign & create auto-generated ipv4 & ipv6
    var serverTestHcloudIndex_serverServer = new HCloud.Server("serverTestHcloudIndex/serverServer", new()
    {
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv6Enabled = 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 {
		_, err := hcloud.NewServer(ctx, "serverTestServer", &hcloud.ServerArgs{
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv4:        pulumi.Any(hcloud_primary_ip.Primary_ip_1.Id),
					Ipv6Enabled: pulumi.Bool(false),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewServer(ctx, "serverTestIndex/serverServer", &hcloud.ServerArgs{
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv4:        pulumi.Any(hcloud_primary_ip.Primary_ip_1.Id),
					Ipv6Enabled: pulumi.Bool(false),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewServer(ctx, "serverTestHcloudIndex/serverServer", &hcloud.ServerArgs{
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv6Enabled: pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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) {
        var serverTestServer = new Server("serverTestServer", ServerArgs.builder()        
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv4(hcloud_primary_ip.primary_ip_1().id())
                .ipv6Enabled(false)
                .build())
            .build());

        var serverTestIndex_serverServer = new Server("serverTestIndex/serverServer", ServerArgs.builder()        
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv4(hcloud_primary_ip.primary_ip_1().id())
                .ipv6Enabled(false)
                .build())
            .build());

        var serverTestHcloudIndex_serverServer = new Server("serverTestHcloudIndex/serverServer", ServerArgs.builder()        
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv6Enabled(true)
                .build())
            .build());

    }
}
resources:
  # Assign existing ipv4 only
  serverTestServer:
    type: hcloud:Server
    properties:
      # ...
      publicNets:
        - ipv4Enabled: true
          ipv4: ${hcloud_primary_ip.primary_ip_1.id}
          ipv6Enabled: false
  # Link a managed ipv4 but autogenerate ipv6
  serverTestIndex/serverServer:
    type: hcloud:Server
    properties:
      # ...
      publicNets:
        - ipv4Enabled: true
          ipv4: ${hcloud_primary_ip.primary_ip_1.id}
          ipv6Enabled: false
  # Assign & create auto-generated ipv4 & ipv6
  serverTestHcloudIndex/serverServer:
    type: hcloud:Server
    properties:
      # ...
      publicNets:
        - ipv4Enabled: true
          ipv6Enabled: true

Example Usage

Server creation with network

using System.Collections.Generic;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    var network = new HCloud.Network("network", new()
    {
        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()
    {
        ServerType = "cx11",
        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 = new[]
        {
            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{
			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{
			ServerType: pulumi.String("cx11"),
			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
	})
}
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()        
            .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()        
            .serverType("cx11")
            .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());

    }
}
import pulumi
import pulumi_hcloud as hcloud

network = hcloud.Network("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",
    server_type="cx11",
    image="ubuntu-20.04",
    location="nbg1",
    networks=[hcloud.ServerNetworkArgs(
        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]))
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const network = new hcloud.Network("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", {
    serverType: "cx11",
    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],
});
resources:
  network:
    type: hcloud:Network
    properties:
      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:
      serverType: cx11
      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

using System.Collections.Generic;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    var packerSnapshot = HCloud.GetImage.Invoke(new()
    {
        WithSelector = "app=foobar",
        MostRecent = true,
    });

    // Create a new server from the snapshot
    var fromSnapshot = new HCloud.Server("fromSnapshot", new()
    {
        Image = packerSnapshot.Apply(getImageResult => getImageResult.Id),
        ServerType = "cx11",
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv6Enabled = 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 {
		packerSnapshot, err := hcloud.GetImage(ctx, &hcloud.GetImageArgs{
			WithSelector: pulumi.StringRef("app=foobar"),
			MostRecent:   pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.NewServer(ctx, "fromSnapshot", &hcloud.ServerArgs{
			Image:      *pulumi.Int(packerSnapshot.Id),
			ServerType: pulumi.String("cx11"),
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv6Enabled: pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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) {
        final var packerSnapshot = HcloudFunctions.getImage(GetImageArgs.builder()
            .withSelector("app=foobar")
            .mostRecent(true)
            .build());

        var fromSnapshot = new Server("fromSnapshot", ServerArgs.builder()        
            .image(packerSnapshot.applyValue(getImageResult -> getImageResult.id()))
            .serverType("cx11")
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv6Enabled(true)
                .build())
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

packer_snapshot = hcloud.get_image(with_selector="app=foobar",
    most_recent=True)
# Create a new server from the snapshot
from_snapshot = hcloud.Server("fromSnapshot",
    image=packer_snapshot.id,
    server_type="cx11",
    public_nets=[hcloud.ServerPublicNetArgs(
        ipv4_enabled=True,
        ipv6_enabled=True,
    )])
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const packerSnapshot = hcloud.getImage({
    withSelector: "app=foobar",
    mostRecent: true,
});
// Create a new server from the snapshot
const fromSnapshot = new hcloud.Server("fromSnapshot", {
    image: packerSnapshot.then(packerSnapshot => packerSnapshot.id),
    serverType: "cx11",
    publicNets: [{
        ipv4Enabled: true,
        ipv6Enabled: true,
    }],
});
resources:
  # Create a new server from the snapshot
  fromSnapshot:
    type: hcloud:Server
    properties:
      image: ${packerSnapshot.id}
      serverType: cx11
      publicNets:
        - ipv4Enabled: true
          ipv6Enabled: true
variables:
  packerSnapshot:
    fn::invoke:
      Function: hcloud:getImage
      Arguments:
        withSelector: app=foobar
        mostRecent: true

Examples

using System.Collections.Generic;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    // Assign existing ipv4 only
    var serverTestServer = new HCloud.Server("serverTestServer", new()
    {
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv4 = hcloud_primary_ip.Primary_ip_1.Id,
                Ipv6Enabled = false,
            },
        },
    });

    //...
    // Link a managed ipv4 but autogenerate ipv6
    var serverTestIndex_serverServer = new HCloud.Server("serverTestIndex/serverServer", new()
    {
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv4 = hcloud_primary_ip.Primary_ip_1.Id,
                Ipv6Enabled = false,
            },
        },
    });

    //...
    // Assign & create auto-generated ipv4 & ipv6
    var serverTestHcloudIndex_serverServer = new HCloud.Server("serverTestHcloudIndex/serverServer", new()
    {
        PublicNets = new[]
        {
            new HCloud.Inputs.ServerPublicNetArgs
            {
                Ipv4Enabled = true,
                Ipv6Enabled = 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 {
		_, err := hcloud.NewServer(ctx, "serverTestServer", &hcloud.ServerArgs{
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv4:        pulumi.Any(hcloud_primary_ip.Primary_ip_1.Id),
					Ipv6Enabled: pulumi.Bool(false),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewServer(ctx, "serverTestIndex/serverServer", &hcloud.ServerArgs{
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv4:        pulumi.Any(hcloud_primary_ip.Primary_ip_1.Id),
					Ipv6Enabled: pulumi.Bool(false),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewServer(ctx, "serverTestHcloudIndex/serverServer", &hcloud.ServerArgs{
			PublicNets: hcloud.ServerPublicNetArray{
				&hcloud.ServerPublicNetArgs{
					Ipv4Enabled: pulumi.Bool(true),
					Ipv6Enabled: pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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) {
        var serverTestServer = new Server("serverTestServer", ServerArgs.builder()        
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv4(hcloud_primary_ip.primary_ip_1().id())
                .ipv6Enabled(false)
                .build())
            .build());

        var serverTestIndex_serverServer = new Server("serverTestIndex/serverServer", ServerArgs.builder()        
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv4(hcloud_primary_ip.primary_ip_1().id())
                .ipv6Enabled(false)
                .build())
            .build());

        var serverTestHcloudIndex_serverServer = new Server("serverTestHcloudIndex/serverServer", ServerArgs.builder()        
            .publicNets(ServerPublicNetArgs.builder()
                .ipv4Enabled(true)
                .ipv6Enabled(true)
                .build())
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

# Assign existing ipv4 only
server_test_server = hcloud.Server("serverTestServer", public_nets=[hcloud.ServerPublicNetArgs(
    ipv4_enabled=True,
    ipv4=hcloud_primary_ip["primary_ip_1"]["id"],
    ipv6_enabled=False,
)])
#...
# Link a managed ipv4 but autogenerate ipv6
server_test_index_server_server = hcloud.Server("serverTestIndex/serverServer", public_nets=[hcloud.ServerPublicNetArgs(
    ipv4_enabled=True,
    ipv4=hcloud_primary_ip["primary_ip_1"]["id"],
    ipv6_enabled=False,
)])
#...
# Assign & create auto-generated ipv4 & ipv6
server_test_hcloud_index_server_server = hcloud.Server("serverTestHcloudIndex/serverServer", public_nets=[hcloud.ServerPublicNetArgs(
    ipv4_enabled=True,
    ipv6_enabled=True,
)])
#...
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

// Assign existing ipv4 only
const serverTestServer = new hcloud.Server("serverTestServer", {publicNets: [{
    ipv4Enabled: true,
    ipv4: hcloud_primary_ip.primary_ip_1.id,
    ipv6Enabled: false,
}]});
//...
// Link a managed ipv4 but autogenerate ipv6
const serverTestIndex_serverServer = new hcloud.Server("serverTestIndex/serverServer", {publicNets: [{
    ipv4Enabled: true,
    ipv4: hcloud_primary_ip.primary_ip_1.id,
    ipv6Enabled: false,
}]});
//...
// Assign & create auto-generated ipv4 & ipv6
const serverTestHcloudIndex_serverServer = new hcloud.Server("serverTestHcloudIndex/serverServer", {publicNets: [{
    ipv4Enabled: true,
    ipv6Enabled: true,
}]});
//...
resources:
  # Assign existing ipv4 only
  serverTestServer:
    type: hcloud:Server
    properties:
      # ...
      publicNets:
        - ipv4Enabled: true
          ipv4: ${hcloud_primary_ip.primary_ip_1.id}
          ipv6Enabled: false
  # Link a managed ipv4 but autogenerate ipv6
  serverTestIndex/serverServer:
    type: hcloud:Server
    properties:
      # ...
      publicNets:
        - ipv4Enabled: true
          ipv4: ${hcloud_primary_ip.primary_ip_1.id}
          ipv6Enabled: false
  # Assign & create auto-generated ipv4 & ipv6
  serverTestHcloudIndex/serverServer:
    type: hcloud:Server
    properties:
      # ...
      publicNets:
        - ipv4Enabled: true
          ipv6Enabled: true

Create Server Resource

new Server(name: string, args: ServerArgs, opts?: CustomResourceOptions);
@overload
def Server(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           allow_deprecated_images: Optional[bool] = 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,
           iso: Optional[str] = None,
           keep_disk: Optional[bool] = None,
           labels: Optional[Mapping[str, Any]] = None,
           location: Optional[str] = None,
           name: Optional[str] = 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,
           server_type: Optional[str] = None,
           ssh_keys: Optional[Sequence[str]] = None,
           user_data: Optional[str] = None)
@overload
def Server(resource_name: str,
           args: ServerArgs,
           opts: Optional[ResourceOptions] = 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.

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.

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

The Server resource accepts the following input properties:

ServerType 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 string

The datacenter name to create the server in.

DeleteProtection bool

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 string

(string) Name or ID of the image the server was created from.

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, object>

User-defined labels (key-value pairs) should be created with.

Location string

The location name to create the server in. nbg1, fsn1, hel1 or ash

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

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.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 linux32 or freebsd64

SshKeys List<string>

SSH key IDs or names which should be injected into the server at creation time

UserData string

Cloud-Init user data to use during server creation

ServerType 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 string

The datacenter name to create the server in.

DeleteProtection bool

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 string

(string) Name or ID of the image the server was created from.

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]interface{}

User-defined labels (key-value pairs) should be created with.

Location string

The location name to create the server in. nbg1, fsn1, hel1 or ash

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 linux32 or freebsd64

SshKeys []string

SSH key IDs or names which should be injected into the server at creation time

UserData string

Cloud-Init user data to use during server creation

serverType 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 String

The datacenter name to create the server in.

deleteProtection Boolean

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 String

(string) Name or ID of the image the server was created from.

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,Object>

User-defined labels (key-value pairs) should be created with.

location String

The location name to create the server in. nbg1, fsn1, hel1 or ash

name String

Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).

networks List<ServerNetworkArgs>

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<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 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 linux32 or freebsd64

sshKeys List<String>

SSH key IDs or names which should be injected into the server at creation time

userData String

Cloud-Init user data to use during server creation

serverType 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 string

The datacenter name to create the server in.

deleteProtection boolean

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 string

(string) Name or ID of the image the server was created from.

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]: any}

User-defined labels (key-value pairs) should be created with.

location string

The location name to create the server in. nbg1, fsn1, hel1 or ash

name string

Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).

networks ServerNetworkArgs[]

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 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 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 linux32 or freebsd64

sshKeys string[]

SSH key IDs or names which should be injected into the server at creation time

userData 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_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 str

The datacenter name to create the server in.

delete_protection bool

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 str

(string) Name or ID of the image the server was created from.

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, Any]

User-defined labels (key-value pairs) should be created with.

location str

The location name to create the server in. nbg1, fsn1, hel1 or ash

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 linux32 or freebsd64

ssh_keys Sequence[str]

SSH key IDs or names which should be injected into the server at creation time

user_data str

Cloud-Init user data to use during server creation

serverType 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 String

The datacenter name to create the server in.

deleteProtection Boolean

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 String

(string) Name or ID of the image the server was created from.

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<Any>

User-defined labels (key-value pairs) should be created with.

location String

The location name to create the server in. nbg1, fsn1, hel1 or ash

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 linux32 or freebsd64

sshKeys List<String>

SSH key IDs or names which should be injected into the server at creation time

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

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.

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.

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.

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.

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.

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, Any]] = None,
        location: Optional[str] = None,
        name: Optional[str] = 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,
        server_type: Optional[str] = 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.
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 string

The datacenter name to create the server in.

DeleteProtection bool

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 string

(string) Name or ID of the image the server was created from.

Ipv4Address string

(string) The IPv4 address.

Ipv6Address string

(string) The first IPv6 address of the assigned network.

Ipv6Network string

(string) The IPv6 network.

Iso string

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, object>

User-defined labels (key-value pairs) should be created with.

Location string

The location name to create the server in. nbg1, fsn1, hel1 or ash

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

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.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 linux32 or freebsd64

ServerType string

Name of the server type this server should be created with.

SshKeys List<string>

SSH key IDs or names which should be injected into the server at creation time

Status string

(string) The status of the server.

UserData 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 string

The datacenter name to create the server in.

DeleteProtection bool

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 string

(string) Name or ID of the image the server was created from.

Ipv4Address string

(string) The IPv4 address.

Ipv6Address string

(string) The first IPv6 address of the assigned network.

Ipv6Network string

(string) The IPv6 network.

Iso string

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]interface{}

User-defined labels (key-value pairs) should be created with.

Location string

The location name to create the server in. nbg1, fsn1, hel1 or ash

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 linux32 or freebsd64

ServerType string

Name of the server type this server should be created with.

SshKeys []string

SSH key IDs or names which should be injected into the server at creation time

Status string

(string) The status of the server.

UserData 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 String

The datacenter name to create the server in.

deleteProtection Boolean

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 String

(string) Name or ID of the image the server was created from.

ipv4Address String

(string) The IPv4 address.

ipv6Address String

(string) The first IPv6 address of the assigned network.

ipv6Network String

(string) The IPv6 network.

iso String

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,Object>

User-defined labels (key-value pairs) should be created with.

location String

The location name to create the server in. nbg1, fsn1, hel1 or ash

name String

Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).

networks List<ServerNetworkArgs>

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<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 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 linux32 or freebsd64

serverType String

Name of the server type this server should be created with.

sshKeys List<String>

SSH key IDs or names which should be injected into the server at creation time

status String

(string) The status of the server.

userData 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 string

The datacenter name to create the server in.

deleteProtection boolean

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 string

(string) Name or ID of the image the server was created from.

ipv4Address string

(string) The IPv4 address.

ipv6Address string

(string) The first IPv6 address of the assigned network.

ipv6Network string

(string) The IPv6 network.

iso string

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]: any}

User-defined labels (key-value pairs) should be created with.

location string

The location name to create the server in. nbg1, fsn1, hel1 or ash

name string

Name of the server to create (must be unique per project and a valid hostname as per RFC 1123).

networks ServerNetworkArgs[]

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 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 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 linux32 or freebsd64

serverType string

Name of the server type this server should be created with.

sshKeys string[]

SSH key IDs or names which should be injected into the server at creation time

status string

(string) The status of the server.

userData 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 str

The datacenter name to create the server in.

delete_protection bool

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 str

(string) Name or ID of the image the server was created from.

ipv4_address str

(string) The IPv4 address.

ipv6_address str

(string) The first IPv6 address of the assigned network.

ipv6_network str

(string) The IPv6 network.

iso str

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, Any]

User-defined labels (key-value pairs) should be created with.

location str

The location name to create the server in. nbg1, fsn1, hel1 or ash

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 linux32 or freebsd64

server_type str

Name of the server type this server should be created with.

ssh_keys Sequence[str]

SSH key IDs or names which should be injected into the server at creation time

status str

(string) The status of the server.

user_data 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 String

The datacenter name to create the server in.

deleteProtection Boolean

Enable or disable delete protection (Needs to be the same as rebuild_protection).

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 String

(string) Name or ID of the image the server was created from.

ipv4Address String

(string) The IPv4 address.

ipv6Address String

(string) The first IPv6 address of the assigned network.

ipv6Network String

(string) The IPv6 network.

iso String

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<Any>

User-defined labels (key-value pairs) should be created with.

location String

The location name to create the server in. nbg1, fsn1, hel1 or ash

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 linux32 or freebsd64

serverType String

Name of the server type this server should be created with.

sshKeys List<String>

SSH key IDs or names which should be injected into the server at creation time

status String

(string) The status of the server.

userData String

Cloud-Init user data to use during server creation

Supporting Types

ServerNetwork

NetworkId int

ID of the network

AliasIps List<string>

Alias IPs the server should have in the Network.

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 int

ID of the network

AliasIps []string

Alias IPs the server should have in the Network.

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 Integer

ID of the network

aliasIps List<String>

Alias IPs the server should have in the Network.

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 number

ID of the network

aliasIps string[]

Alias IPs the server should have in the Network.

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 int

ID of the network

alias_ips Sequence[str]

Alias IPs the server should have in the Network.

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 Number

ID of the network

aliasIps List<String>

Alias IPs the server should have in the Network.

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

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 myserver id

Package Details

Repository
Hetzner Cloud pulumi/pulumi-hcloud
License
Apache-2.0
Notes

This Pulumi package is based on the hcloud Terraform Provider.