Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

Server

Import

Servers can be imported using the server id

 $ pulumi import hcloud:index/server:Server myserver <id>

Create a Server Resource

new Server(name: string, args: ServerArgs, opts?: CustomResourceOptions);
def Server(resource_name: str, opts: Optional[ResourceOptions] = None, backups: Optional[bool] = None, datacenter: Optional[str] = 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, rescue: Optional[str] = None, server_type: Optional[str] = None, ssh_keys: Optional[Sequence[str]] = None, user_data: Optional[str] = None)
func NewServer(ctx *Context, name string, args ServerArgs, opts ...ResourceOption) (*Server, error)
public Server(string name, ServerArgs args, CustomResourceOptions? opts = null)
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.
opts ResourceOptions
A bag of options that control this 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.

Server Resource Properties

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

Inputs

The Server resource accepts the following input properties:

Image string

Name or ID of the image the server is created from.

ServerType string

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

Backups bool

Enable or disable backups.

Datacenter string

The datacenter name to create the server in.

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 or hel1

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

Image string

Name or ID of the image the server is created from.

ServerType string

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

Backups bool

Enable or disable backups.

Datacenter string

The datacenter name to create the server in.

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 or hel1

Name string

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

Networks []ServerNetworkType
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

image string

Name or ID of the image the server is created from.

serverType string

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

backups boolean

Enable or disable backups.

datacenter string

The datacenter name to create the server in.

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 or hel1

name string

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

networks ServerNetwork[]
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

image str

Name or ID of the image the server is created from.

server_type str

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

backups bool

Enable or disable backups.

datacenter str

The datacenter name to create the server in.

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 or hel1

name str

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

networks Sequence[ServerNetworkArgs]
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

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.

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.

Look up an 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, backup_window: Optional[str] = None, backups: Optional[bool] = None, datacenter: Optional[str] = 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, 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)
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.

The following state arguments are supported:

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.

Image string

Name or ID of the image the server is 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 or hel1

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

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.

Image string

Name or ID of the image the server is 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 or hel1

Name string

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

Networks []ServerNetworkType
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

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.

image string

Name or ID of the image the server is 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 or hel1

name string

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

networks ServerNetwork[]
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

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.

image str

Name or ID of the image the server is 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 or hel1

name str

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

networks Sequence[ServerNetworkArgs]
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

Supporting Types

ServerNetwork

NetworkId int
AliasIps List<string>
Ip string
MacAddress string
NetworkId int
AliasIps []string
Ip string
MacAddress string
networkId number
aliasIps string[]
ip string
macAddress string
network_id int
alias_ips Sequence[str]
ip str
mac_address str

Package Details

Repository
https://github.com/pulumi/pulumi-hcloud
License
Apache-2.0
Notes
This Pulumi package is based on the hcloud Terraform Provider.