feat: subnets attached to compute, added tf destroy
This commit is contained in:
@@ -3,14 +3,34 @@ resource "hcloud_ssh_key" "key" {
|
||||
public_key = file(var.public_key_file)
|
||||
}
|
||||
|
||||
resource "hcloud_network" "net" {
|
||||
name = "kthw-net"
|
||||
ip_range = "10.0.0.0/8"
|
||||
}
|
||||
|
||||
resource "hcloud_network_subnet" "subnet" {
|
||||
type = "cloud"
|
||||
network_id = hcloud_network.net.id
|
||||
network_zone = "eu-central"
|
||||
ip_range = "10.0.0.0/16"
|
||||
}
|
||||
|
||||
resource "hcloud_server" "boxes" {
|
||||
for_each = var.boxes
|
||||
name = each.value
|
||||
name = "kthw-${each.key}"
|
||||
image = "debian-12"
|
||||
ssh_keys = [hcloud_ssh_key.key.id]
|
||||
server_type = "cx23"
|
||||
|
||||
network {
|
||||
network_id = hcloud_network.net.id
|
||||
ip = each.value.private_ip
|
||||
}
|
||||
|
||||
public_net {
|
||||
ipv4_enabled = true
|
||||
ipv6_enabled = false
|
||||
}
|
||||
|
||||
depends_on = [ hcloud_network_subnet.subnet ]
|
||||
}
|
||||
Reference in New Issue
Block a user