» hcloud_server
Provides an Hetzner Cloud server resource. This can be used to create, modify, and delete servers. Servers also support provisioning.
» Example Usage
# Create a new server running debian
resource "hcloud_server" "node1" {
name = "node1"
image = "debian-9"
server_type = "cx11"
}
» Argument Reference
The following arguments are supported:
-
name
- (Required, string) Name of the server to create (must be unique per project and a valid hostname as per RFC 1123). -
server_type
- (Required, string) Name of the server type this server should be created with. -
image
- (Required, string) Name or ID of the image the server is created from. -
location
- (Optional, string) The location name to create the server in.nbg1
,fsn1
orhel1
-
datacenter
- (Optional, string) The datacenter name to create the server in. -
user_data
- (Optional, string) Cloud-Init user data to use during server creation -
ssh_keys
- (Optional, list) SSH key IDs or names which should be injected into the server at creation time -
keep_disk
- (Optional, bool) If true, do not upgrade the disk. This allows downgrading the server type later. -
iso
- (Optional, string) Name of an ISO image to mount. -
rescue
- (Optional, string) Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems.linux64
linux32
orfreebsd64
-
labels
- (Optional, map) User-defined labels (key-value pairs) should be created with. -
backups
- (Optional, boolean) Enable or disable backups.
» Attributes Reference
The following attributes are exported:
-
id
- (int) Unique ID of the server. -
name
- (string) Name of the server. -
server_type
- (string) Name of the server type. -
image
- (string) Name or ID of the image the server was created from. -
location
- (string) The location name. -
datacenter
- (string) The datacenter name. -
backup_window
- (string) The backup window of the server, if enabled. -
backups
- (boolean) Whether backups are enabled. -
iso
- (string) Name of the mounted ISO image. -
ipv4_address
- (string) The IPv4 address. -
ipv6_address
- (string) The first IPv6 address of the assigned network. -
ipv6_network
- (string) The IPv6 network. -
status
- (string) The status of the server. -
labels
- (map) User-defined labels (key-value pairs)
» Import
Servers can be imported using the server id
:
terraform import hcloud_server.myserver <id>