Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zoro16/terraform-hcloud-server

Terraform module to provision Server resource in Hetzner Cloud along with other optional resources e.g. Snapshot, Primary IP etc.
https://github.com/zoro16/terraform-hcloud-server

hcloud-server hetzner hetzner-cloud hetzner-cloud-server terraform-hcloud-server terraform-module

Last synced: about 2 months ago
JSON representation

Terraform module to provision Server resource in Hetzner Cloud along with other optional resources e.g. Snapshot, Primary IP etc.

Awesome Lists containing this project

README

        

## Description

Terraform module to provision `Server` resource in Hetzner Cloud along with other optional resources e.g. `Snapshot`, `Primary IP` etc.

## Usage

```hcl
provider "hcloud" {
token = var.hcloud_token
}

# Create and SSH Key with: `ssh-keygen -q -t ed25519 -N '' -f ./tf-example << /dev/null 2>&1`
resource "hcloud_ssh_key" "key" {
name = "tf_key"
public_key = file("./tf-example.pub")
}

module "sv" {
source = "../.."

create_server = true
server_name = "example-server"
server_type = var.server_type_map.arm64_2_4GB
location = "fsn1"
backups = true
image = "debian-12"

ssh_keys = [hcloud_ssh_key.key.id]
}

```

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.2.0 |
| [hcloud](#requirement\_hcloud) | >= 1.48 |

## Providers

| Name | Version |
|------|---------|
| [hcloud](#provider\_hcloud) | >= 1.48 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [hcloud_placement_group.placement](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/placement_group) | resource |
| [hcloud_primary_ip.primary](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/primary_ip) | resource |
| [hcloud_server.server](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/server) | resource |
| [hcloud_snapshot.snapshot](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/snapshot) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [allow\_deprecated\_images](#input\_allow\_deprecated\_images) | Enable the use of deprecated images (default: false). Note Deprecated images will be removed after three months. Using them is then no longer possible. | `bool` | `false` | no |
| [backups](#input\_backups) | Whether to enable or disable backups. | `bool` | `true` | no |
| [create\_placement\_group](#input\_create\_placement\_group) | A boolean to check whether to create a Placement Group resource or not. | `bool` | `false` | no |
| [create\_primary\_ip](#input\_create\_primary\_ip) | A boolean to check whether to create a Primary IP resource or not. | `bool` | `false` | no |
| [create\_server](#input\_create\_server) | A boolean to check whether to create a Server resource or not. | `bool` | `false` | no |
| [create\_snapshot](#input\_create\_snapshot) | A boolean to check whether to create a Snapshot resource or not. | `bool` | `false` | no |
| [datacenter](#input\_datacenter) | The datacenter name to create the server in. nbg1-dc3, fsn1-dc14, hel1-dc2, ash-dc1 or hil-dc1. The following a mapping for the datacenters and their region | `string` | `null` | no |
| [delete\_protection](#input\_delete\_protection) | Enable or disable delete protection (Needs to be the same as rebuild\_protection). | `bool` | `false` | no |
| [firewall\_ids](#input\_firewall\_ids) | Firewall IDs the server should be attached to on creation. | `list(any)` | `[]` | no |
| [ignore\_remote\_firewall\_ids](#input\_ignore\_remote\_firewall\_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 the `hcloud_firewall_attachment` resource for a reason to use this argument. | `bool` | `false` | no |
| [image](#input\_image) | The name of Hcloud OS image e.g. Debain, Ubuntu etc. | `string` | `"debian-12"` | no |
| [iso](#input\_iso) | ID or Name of an ISO image to mount. | `string` | `""` | no |
| [keep\_disk](#input\_keep\_disk) | If true, do not upgrade the disk. This allows downgrading the server type later. | `bool` | `false` | no |
| [labels](#input\_labels) | User-defined labels (key-value pairs) should be created with. | `map(string)` | `{}` | no |
| [location](#input\_location) | The location name to create the server in. nbg1, fsn1, hel1, ash or hil | `string` | `"fsn1"` | no |
| [placement\_group\_id](#input\_placement\_group\_id) | Placement Group ID the server added to on creation. | `string` | `null` | no |
| [placement\_group\_labels](#input\_placement\_group\_labels) | User-defined labels (key-value pairs) should be created with. | `map(string)` | `{}` | no |
| [placement\_group\_name](#input\_placement\_group\_name) | Name of the Placement Group to be created. | `string` | `""` | no |
| [placement\_group\_type](#input\_placement\_group\_type) | Type of the Placement Group to be created. | `string` | `"spread"` | no |
| [primary\_ip\_assignee\_id](#input\_primary\_ip\_assignee\_id) | ID of the assigned resource. | `number` | `null` | no |
| [primary\_ip\_assignee\_type](#input\_primary\_ip\_assignee\_type) | The type of the assigned resource. Currently supported: server | `string` | `"server"` | no |
| [primary\_ip\_auto\_delete](#input\_primary\_ip\_auto\_delete) | Whether auto delete is enabled. Important note:It is recommended to set auto\_delete to false, because if a server assigned to the managed ip is getting deleted, it will also delete the primary IP which will break the TF state. | `bool` | `false` | no |
| [primary\_ip\_datacenter](#input\_primary\_ip\_datacenter) | The datacenter name to create the resource in. | `string` | `null` | no |
| [primary\_ip\_delete\_protection](#input\_primary\_ip\_delete\_protection) | Whether delete protection is enabled or not. | `bool` | `false` | no |
| [primary\_ip\_labels](#input\_primary\_ip\_labels) | Description of the Primary IP. | `map(string)` | `{}` | no |
| [primary\_ip\_name](#input\_primary\_ip\_name) | Name of the Primary IP. | `string` | `null` | no |
| [primary\_ip\_type](#input\_primary\_ip\_type) | Type of the Primary IP. `ipv4` or `ipv6` | `string` | `"ipv4"` | no |
| [primary\_ipv4](#input\_primary\_ipv4) | This is static IP that could be assign to any server in the time of server creation or after that. Note that the server and this IP should be in the same region e.g. eu-central | `string` | `null` | no |
| [primary\_ipv6](#input\_primary\_ipv6) | This is static IP that could be assign to any server in the time of server creation or after that. Note that the server and this IP should be in the same region e.g. eu-central | `string` | `null` | no |
| [private\_network\_alias\_ips](#input\_private\_network\_alias\_ips) | Alias IPs the server should have in the Network. | `list(string)` | `[]` | no |
| [private\_network\_id](#input\_private\_network\_id) | ID of the network the server well be attached. | `number` | `null` | no |
| [private\_network\_ip](#input\_private\_network\_ip) | Specify the IP the server should get in the network. | `string` | `null` | no |
| [public\_net\_ipv4\_enabled](#input\_public\_net\_ipv4\_enabled) | Whether to enable or disable a public IPv4 (could be access from the Internet). | `bool` | `true` | no |
| [public\_net\_ipv6\_enabled](#input\_public\_net\_ipv6\_enabled) | Whether to enable or disable a public IPv6 (could be access from the Internet). | `bool` | `true` | no |
| [rebuild\_protection](#input\_rebuild\_protection) | Enable or disable rebuild protection (Needs to be the same as delete\_protection). | `bool` | `false` | no |
| [rescue](#input\_rescue) | Enable and boot in to the specified rescue system. This enables simple installation of custom operating systems. linux64 or linux32 | `string` | `""` | no |
| [server\_id](#input\_server\_id) | ID of the server that already created. | `number` | `null` | no |
| [server\_name](#input\_server\_name) | Name of the server to create (must be unique per project and a valid hostname as per RFC 1123). | `string` | `"some-server-name"` | no |
| [server\_type](#input\_server\_type) | (Required, string) Name of the server type this server should be created with. | `string` | `"cx22"` | no |
| [shutdown\_before\_deletion](#input\_shutdown\_before\_deletion) | Whether to try shutting the server down gracefully before deleting it. | `bool` | `false` | no |
| [snapshot\_description](#input\_snapshot\_description) | Description of the snapshot. | `string` | `""` | no |
| [snapshot\_labels](#input\_snapshot\_labels) | User-defined labels (key-value pairs) should be created with. | `map(string)` | `{}` | no |
| [ssh\_keys](#input\_ssh\_keys) | SSH key IDs or names which should be injected into the server at creation time. | `list(string)` | `[]` | no |
| [user\_data](#input\_user\_data) | This could be a Bash script or cloud-init configurations that would run the first time the VM is provisioned. | `string` | `""` | no |

## Outputs

| Name | Description |
|------|-------------|
| [placement\_group\_id](#output\_placement\_group\_id) | Placement Group ID the server added to on creation. |
| [placement\_group\_labels](#output\_placement\_group\_labels) | Placement Group ID the server added to on creation. |
| [placement\_group\_name](#output\_placement\_group\_name) | Name of the Placement Group to be created. |
| [placement\_group\_type](#output\_placement\_group\_type) | Type of the Placement Group to be created. |
| [primary\_ip\_assignee\_id](#output\_primary\_ip\_assignee\_id) | ID of the assigned resource. |
| [primary\_ip\_assignee\_type](#output\_primary\_ip\_assignee\_type) | The type of the assigned resource. Currently supported: server |
| [primary\_ip\_auto\_delete](#output\_primary\_ip\_auto\_delete) | Whether auto delete is enabled. Important note:It is recommended to set auto\_delete to false, because if a server assigned to the managed ip is getting deleted, it will also delete the primary IP which will break the TF state. |
| [primary\_ip\_datacenter](#output\_primary\_ip\_datacenter) | The datacenter name to create the resource in. |
| [primary\_ip\_delete\_protection](#output\_primary\_ip\_delete\_protection) | Whether delete protection is enabled or not. |
| [primary\_ip\_id](#output\_primary\_ip\_id) | Unique ID of the Primary IP. |
| [primary\_ip\_ip\_address](#output\_primary\_ip\_ip\_address) | IP Address of the Primary IP. |
| [primary\_ip\_ip\_network](#output\_primary\_ip\_ip\_network) | IPv6 subnet of the Primary IP for IPv6 addresses. (Only set if type is ipv6) |
| [primary\_ip\_labels](#output\_primary\_ip\_labels) | Description of the Primary IP. |
| [primary\_ip\_name](#output\_primary\_ip\_name) | Name of the Primary IP. |
| [primary\_ip\_type](#output\_primary\_ip\_type) | Type of the Primary IP. `ipv4` or `ipv6` |
| [server\_backups](#output\_server\_backups) | Whether the backups are enabled or not. |
| [server\_datacenter](#output\_server\_datacenter) | The datacenter that the server is located in. |
| [server\_delete\_protection](#output\_server\_delete\_protection) | Whether delete protection is enabled. |
| [server\_firewall\_ids](#output\_server\_firewall\_ids) | Firewall IDs the server is attached to. |
| [server\_id](#output\_server\_id) | Unique ID of the server. |
| [server\_image](#output\_server\_image) | Name or ID of the image the server was created from. |
| [server\_ipv4\_address](#output\_server\_ipv4\_address) | The IPV4 Address for the VM server |
| [server\_ipv6\_address](#output\_server\_ipv6\_address) | The IPV6 Address for the VM server |
| [server\_labels](#output\_server\_labels) | The User-defined labels (key-value pairs) |
| [server\_location](#output\_server\_location) | The location of the server |
| [server\_name](#output\_server\_name) | Name of the server. |
| [server\_private\_network](#output\_server\_private\_network) | Private Network the server shall be attached to. The Network that should be attached to the server requires at least one subnetwork. Subnetworks cannot be referenced by Servers in the Hetzner Cloud API. Therefore Terraform attempts to create the subnetwork in parallel to the server. This leads to a concurrency issue. It is therefore necessary to use depends\_on to link the server to the respective subnetwork. See examples. |
| [server\_private\_network\_alias\_ips](#output\_server\_private\_network\_alias\_ips) | Private Network Alias IPs |
| [server\_private\_network\_id](#output\_server\_private\_network\_id) | Private Network IDs |
| [server\_private\_network\_ip](#output\_server\_private\_network\_ip) | Private Network IPs |
| [server\_private\_network\_mac\_address](#output\_server\_private\_network\_mac\_address) | Private Network MAC Address' |
| [server\_rebuild\_protection](#output\_server\_rebuild\_protection) | Whether rebuild protection is enabled. |
| [server\_shutdown\_before\_deletion](#output\_server\_shutdown\_before\_deletion) | Whether the server will try to shut down gracefully before being deleted. |
| [server\_status](#output\_server\_status) | The status of the server. |
| [server\_type](#output\_server\_type) | The type of the server. |
| [snapshot\_description](#output\_snapshot\_description) | The description of the snapshot. |
| [snapshot\_id](#output\_snapshot\_id) | Unique ID of the snapshot. |
| [snapshot\_labels](#output\_snapshot\_labels) | The user-defined labels |
| [snapshot\_server\_id](#output\_snapshot\_server\_id) | The server that the snapshot was created from. |