Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/ujstor/terraform-hetzner-modules

Terraform modules for deploying Hetzner infrastructure
https://github.com/ujstor/terraform-hetzner-modules

Last synced: about 1 month ago
JSON representation

Terraform modules for deploying Hetzner infrastructure

Awesome Lists containing this project

README

        

# Hetzner Terraform Modules

Modules for simplifying the creation of resources on Hetzner Cloud and Cloudflare.

![purple-divider](https://user-images.githubusercontent.com/7065401/52071927-c1cd7100-2562-11e9-908a-dde91ba14e59.png)
## Module: cluster

## Requirements

| Name | Version |
|------|---------|
| [cloudflare](#requirement\_cloudflare) | ~> 4.37 |
| [hcloud](#requirement\_hcloud) | ~> 1.47 |
| [tls](#requirement\_tls) | ~> 4.0 |

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| [firewall](#module\_firewall) | ../network/firewall | n/a |
| [server](#module\_server) | ../server/ | n/a |
| [ssh\_key](#module\_ssh\_key) | ../ssh_key/ | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [firewall\_config](#input\_firewall\_config) | A map of firewalls to create |

map(object({
name = string
labels = optional(map(string), {})
rules = list(object({
direction = string
protocol = string
port = string
source_ips = optional(list(string))
destination_ips = optional(list(string))
description = optional(string)
}))
}))
| `{}` | no |
| [server\_config](#input\_server\_config) | Configuration for servers |
map(object({
location = string
server_type = string
labels = optional(map(string))
ipv4_enabled = optional(bool)
ipv6_enabled = optional(bool)
subnet_id = string
subnet_ip = string
firewall_ids = optional(list(string))
}))
| n/a | yes |
| [ssh\_key\_name](#input\_ssh\_key\_name) | Name of the SSH key | `string` | `"cluster_hetzner_key"` | no |
| [ssh\_key\_path](#input\_ssh\_key\_path) | Path to the SSH key | `string` | `"~/.ssh"` | no |
| [use\_network](#input\_use\_network) | Flag to use network | `bool` | `true` | no |

## Outputs

| Name | Description |
|------|-------------|
| [server\_status](#output\_server\_status) | n/a |

![purple-divider](https://user-images.githubusercontent.com/7065401/52071927-c1cd7100-2562-11e9-908a-dde91ba14e59.png)

## Module: cloudflare_record

## Requirements

| Name | Version |
|------|---------|
| [cloudflare](#requirement\_cloudflare) | ~> 4.37 |

## Providers

| Name | Version |
|------|---------|
| [cloudflare](#provider\_cloudflare) | ~> 4.37 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [cloudflare_record.domain_recorda](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/record) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [cloudflare\_record](#input\_cloudflare\_record) | Cloudflare record configuration |

map(object({
zone_id = string
name = string
content = string
type = string
ttl = number
proxied = bool
}))
| n/a | yes |

## Outputs

No outputs.

![purple-divider](https://user-images.githubusercontent.com/7065401/52071927-c1cd7100-2562-11e9-908a-dde91ba14e59.png)

## Module: firewall

## Requirements

| Name | Version |
|------|---------|
| [hcloud](#requirement\_hcloud) | ~> 1.47 |

## Providers

| Name | Version |
|------|---------|
| [hcloud](#provider\_hcloud) | ~> 1.47 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [hcloud_firewall.default](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/firewall) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [firewalls](#input\_firewalls) | A map of firewalls to create |

map(object({
name = string
labels = optional(map(string), {})
rules = list(object({
direction = string
protocol = string
port = string
source_ips = optional(list(string))
destination_ips = optional(list(string))
description = optional(string)
}))
}))
| n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [firewall\_ids](#output\_firewall\_ids) | n/a |
| [firewall\_ids\_list](#output\_firewall\_ids\_list) | n/a |

![purple-divider](https://user-images.githubusercontent.com/7065401/52071927-c1cd7100-2562-11e9-908a-dde91ba14e59.png)

## Module: loadbalancer

## Requirements

| Name | Version |
|------|---------|
| [hcloud](#requirement\_hcloud) | ~> 1.47 |

## Providers

| Name | Version |
|------|---------|
| [hcloud](#provider\_hcloud) | ~> 1.47 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [hcloud_load_balancer.lb](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/load_balancer) | resource |
| [hcloud_load_balancer_network.serve_network](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/load_balancer_network) | resource |
| [hcloud_load_balancer_target.load_balancer_target](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/load_balancer_target) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [lb\_config](#input\_lb\_config) | Load balancer configuration. |

map(object({
name = string
load_balancer_type = string
network_zone = optional(string)
location = optional(string) #Require when no network_zone is set
algorithm = optional(object({ type = string }))
labels = optional(map(string))
load_balancer_targets = optional(object({
type = string #server, label_selector, ip
server_id = optional(string) #if type server
label_selector = optional(string)
ip = optional(string) #if type ip
use_private_ip = optional(bool) #if type server or label_selector
}))
load_balancer_network = optional(object({
#Use depends_on to make sure the network is created before the load balancer
network_id = optional(string) #or network id or subnet id
subnet_id = optional(string)
ip = optional(string) #subnet ip
}))
}))
| n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [lb\_status](#output\_lb\_status) | n/a |

![purple-divider](https://user-images.githubusercontent.com/7065401/52071927-c1cd7100-2562-11e9-908a-dde91ba14e59.png)

## Module: vpc_subnet

## Requirements

| Name | Version |
|------|---------|
| [hcloud](#requirement\_hcloud) | ~> 1.47 |

## Providers

| Name | Version |
|------|---------|
| [hcloud](#provider\_hcloud) | ~> 1.47 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [hcloud_network.network](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/network) | resource |
| [hcloud_network_subnet.deployment_subnet](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/network_subnet) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [network\_type](#input\_network\_type) | Network Type | `string` | `"cloud"` | no |
| [network\_zone](#input\_network\_zone) | Network Zone | `string` | `"eu-central"` | no |
| [subnet\_config](#input\_subnet\_config) | Subnet Configuration |

map(object({
subnet_ip_range = string
}))
| n/a | yes |
| [vpc\_config](#input\_vpc\_config) | VPC Configuration |
object({
vpc_name = string
vpc_ip_range = string
})
| n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [network\_id](#output\_network\_id) | The ID of the VPC network. |
| [subnet\_id](#output\_subnet\_id) | The ID of the subnet. |

![purple-divider](https://user-images.githubusercontent.com/7065401/52071927-c1cd7100-2562-11e9-908a-dde91ba14e59.png)

## Module: server

## Requirements

| Name | Version |
|------|---------|
| [hcloud](#requirement\_hcloud) | ~> 1.47 |

## Providers

| Name | Version |
|------|---------|
| [hcloud](#provider\_hcloud) | ~> 1.47 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [hcloud_server.server](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/server) | resource |
| [hcloud_server_network.subnet_controler](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/server_network) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [firewall\_ids](#input\_firewall\_ids) | Firewall IDs to pass to the server | `list(string)` | `null` | no |
| [hcloud\_ssh\_key\_id](#input\_hcloud\_ssh\_key\_id) | ID of the SSH key created and used for Hetzner cloud and serves | `list(string)` | n/a | yes |
| [os\_type](#input\_os\_type) | OS image to use for the server | `string` | `"debian-12"` | no |
| [server\_config](#input\_server\_config) | Config for each created server |

map(object({
location = string
server_type = string
labels = optional(map(string))
ipv4_enabled = optional(bool)
ipv6_enabled = optional(bool)
subnet_id = optional(string)
subnet_ip = optional(string)
firewall_ids = optional(list(string))
}))
| n/a | yes |
| [use\_network](#input\_use\_network) | Use VPC and subnets | `bool` | `false` | no |

## Outputs

| Name | Description |
|------|-------------|
| [server\_info](#output\_server\_info) | n/a |

![purple-divider](https://user-images.githubusercontent.com/7065401/52071927-c1cd7100-2562-11e9-908a-dde91ba14e59.png)

## Module: ssh_key

## Requirements

| Name | Version |
|------|---------|
| [hcloud](#requirement\_hcloud) | ~> 1.47 |
| [tls](#requirement\_tls) | ~> 4.0 |

## Providers

| Name | Version |
|------|---------|
| [hcloud](#provider\_hcloud) | ~> 1.47 |
| [tls](#provider\_tls) | ~> 4.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [hcloud_ssh_key.default](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/ssh_key) | resource |
| [tls_private_key.ssh_key](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [ssh\_key\_name](#input\_ssh\_key\_name) | Name of the SSH key created and used for Hetzner cloud and serves | `string` | `"hetzner_ssh_key"` | no |
| [ssh\_key\_path](#input\_ssh\_key\_path) | Path where the SSH key is stored | `string` | `"~/.ssh"` | no |

## Outputs

| Name | Description |
|------|-------------|
| [hcloud\_ssh\_key\_id](#output\_hcloud\_ssh\_key\_id) | Pass Hcloud ssh key id into server |
| [public\_key](#output\_public\_key) | Public key |

![purple-divider](https://user-images.githubusercontent.com/7065401/52071927-c1cd7100-2562-11e9-908a-dde91ba14e59.png)

## Module: volumes

## Requirements

| Name | Version |
|------|---------|
| [hcloud](#requirement\_hcloud) | ~> 1.47 |

## Providers

| Name | Version |
|------|---------|
| [hcloud](#provider\_hcloud) | ~> 1.47 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [hcloud_volume.vol](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/volume) | resource |
| [hcloud_volume_attachment.vol_attachment](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/volume_attachment) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [volume\_config](#input\_volume\_config) | Volume configuration |

map(object({
size = number
location = string
server_id = string
}))
| n/a | yes |
| [volume\_format](#input\_volume\_format) | Format volume after creation (xfs or ext4) | `string` | `"xfs"` | no |

## Outputs

No outputs.

![purple-divider](https://user-images.githubusercontent.com/7065401/52071927-c1cd7100-2562-11e9-908a-dde91ba14e59.png)