feat: networking
This commit is contained in:
26
terraform/main.tf
Normal file
26
terraform/main.tf
Normal file
@@ -0,0 +1,26 @@
|
||||
// Set up network for compute to live.
|
||||
resource "hcloud_network" "net" {
|
||||
name = "Private Network"
|
||||
ip_range = local.net-cidr
|
||||
}
|
||||
|
||||
// Attach the NAT to the network.
|
||||
resource "hcloud_server_network" "nat-to-net" {
|
||||
server_id = hcloud_server.nat.id
|
||||
network_id = hcloud_network.net.id
|
||||
ip = local.nat-private-ip
|
||||
}
|
||||
|
||||
// Provide internet to the private servers, by sending all internet traffic to
|
||||
// the NAT.
|
||||
resource "hcloud_network_route" "gateway" {
|
||||
network_id = hcloud_network.net.id
|
||||
destination = "0.0.0.0/0"
|
||||
gateway = local.nat-private-ip
|
||||
}
|
||||
|
||||
// Give the NAT a public IP.
|
||||
resource "hcloud_floating_ip" "master" {
|
||||
type = "ipv4"
|
||||
server_id = hcloud_server.nat.id
|
||||
}
|
||||
Reference in New Issue
Block a user