https://github.com/zoro16/terraform-hcloud-network
Terraform module to provision Network resouces in Hetzner Cloud
https://github.com/zoro16/terraform-hcloud-network
hcloud-network hetzner hetzner-cloud hetzner-network terraform-hcloud-network terraform-module
Last synced: about 1 year ago
JSON representation
Terraform module to provision Network resouces in Hetzner Cloud
- Host: GitHub
- URL: https://github.com/zoro16/terraform-hcloud-network
- Owner: zoro16
- License: mit
- Created: 2023-09-24T20:35:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-22T13:21:19.000Z (almost 2 years ago)
- Last Synced: 2025-04-15T20:13:05.757Z (about 1 year ago)
- Topics: hcloud-network, hetzner, hetzner-cloud, hetzner-network, terraform-hcloud-network, terraform-module
- Language: HCL
- Homepage: https://registry.terraform.io/modules/zoro16/network/hcloud/latest
- Size: 29.3 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Description
Terraform module to help with provisioning `Network`, `Subnet` and `Network Route` resources in Hetzner Cloud.
## Usage
```hcl
# Configure the Hetzner Cloud Provider
provider "hcloud" {
token = var.hcloud_token
}
locals {
network_routes = tomap({
"0.0.0.0/0" = "10.100.0.2"
})
}
module "net" {
source = "../../"
create_network = true
network_name = "example-network"
network_ip_cidr_range = "10.100.0.0/16"
network_delete_protection = false
network_expose_routes_to_vswitch = false
network_labels = {
name = "example-network"
environment = "dev"
}
create_subnet = true
subnet_type = "cloud"
subnet_network_zone = "eu-central"
subnet_ip_cidr_ranges = ["10.100.20.0/24", "10.100.30.0/24"]
create_network_route = true
network_routes = local.network_routes
}
```
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.2.0 |
| [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_route.private_net](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/network_route) | resource |
| [hcloud_network_subnet.subnet](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/network_subnet) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [create\_network](#input\_create\_network) | A boolean to check whether to create a network resource or not. | `bool` | `false` | no |
| [create\_network\_route](#input\_create\_network\_route) | A boolean to check whether to create a Network Route resource or not. | `bool` | `false` | no |
| [create\_subnet](#input\_create\_subnet) | A boolean to check whether to create a subent resource or not. | `bool` | `false` | no |
| [network\_delete\_protection](#input\_network\_delete\_protection) | Enable or disable delete protection. | `bool` | `false` | no |
| [network\_expose\_routes\_to\_vswitch](#input\_network\_expose\_routes\_to\_vswitch) | Enable or disable exposing the routes to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.. | `bool` | `false` | no |
| [network\_ip\_cidr\_range](#input\_network\_ip\_cidr\_range) | IP CIDR Range of the whole Network which must span all included subnets and route destinations. Must be one of the private ipv4 ranges of RFC1918. | `string` | `"10.0.0.0/8"` | no |
| [network\_labels](#input\_network\_labels) | User-defined labels (key-value pairs) should be created with. | `map(any)` | `{}` | no |
| [network\_name](#input\_network\_name) | Name of the network to be created (must be unique per project). | `string` | `""` | no |
| [network\_routes](#input\_network\_routes) | A map between route\_destinations to route\_gateways. | `map(any)` | `{}` | no |
| [subnet\_ip\_cidr\_ranges](#input\_subnet\_ip\_cidr\_ranges) | Range to allocate IPs from. Must be a subnet of the ip\_range of the Network and must not overlap with any other subnets or with any destinations in routes. | `list(string)` |
[
"10.0.0.0/24"
]
| no |
| [subnet\_network\_zone](#input\_subnet\_network\_zone) | Name of the network zone e.g. eu-central, us-east, us-west. | `string` | `""` | no |
| [subnet\_type](#input\_subnet\_type) | Type of subnet e.g. `server`, `cloud` or `vswitch`. | `string` | `""` | no |
| [subnet\_vswitch\_id](#input\_subnet\_vswitch\_id) | ID of the vswitch, Required if type is `vswitch` | `number` | `null` | no |
## Outputs
| Name | Description |
|------|-------------|
| [network\_delete\_protection](#output\_network\_delete\_protection) | Enable or disable delete protection. |
| [network\_expose\_routes\_to\_vswitch](#output\_network\_expose\_routes\_to\_vswitch) | Enable or disable exposing the routes to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.. |
| [network\_id](#output\_network\_id) | Unique ID of the network. |
| [network\_ip\_cidr\_range](#output\_network\_ip\_cidr\_range) | IP CIDR Range of the whole Network which must span all included subnets and route destinations. Must be one of the private ipv4 ranges of RFC1918. |
| [network\_labels](#output\_network\_labels) | User-defined labels (key-value pairs) should be created with. |
| [network\_name](#output\_network\_name) | Name of the network to be created (must be unique per project). |
| [network\_route\_destination](#output\_network\_route\_destination) | Destination network or host of this route. Must be a subnet of the ip\_range of the Network. Must not overlap with an existing ip\_range in any subnets or with any destinations in other routes or with the first ip of the networks ip\_range or with 172.31.1.1. |
| [network\_route\_gateway](#output\_network\_route\_gateway) | Gateway for the route. Cannot be the first ip of the networks ip\_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers. |
| [network\_route\_id](#output\_network\_route\_id) | ID of the Network the route should be added to. |
| [network\_route\_network\_id](#output\_network\_route\_network\_id) | ID of the Network the route should be added to. |
| [subnet\_id](#output\_subnet\_id) | ID of the Network subnet. |
| [subnet\_ip\_cidr\_range](#output\_subnet\_ip\_cidr\_range) | Range to allocate IPs from. Must be a subnet of the ip\_range of the Network and must not overlap with any other subnets or with any destinations in routes. |
| [subnet\_network\_id](#output\_subnet\_network\_id) | ID of the Network the subnet should be added to. |
| [subnet\_network\_zone](#output\_subnet\_network\_zone) | Name of the network zone e.g. eu-central, us-east, us-west. |
| [subnet\_type](#output\_subnet\_type) | Type of subnet e.g. `server`, `cloud` or `vswitch`. |
| [subnet\_vswitch\_id](#output\_subnet\_vswitch\_id) | ID of the vswitch, Required if type is `vswitch` |