diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index 3d0caa4..1da6c44 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -2,23 +2,23 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hetznercloud/hcloud" { - version = "1.33.2" - constraints = "1.33.2" + version = "1.35.0" + constraints = "~> 1.35.0" hashes = [ - "h1:eJgsOvtFpzV0C/3sdosUOgsCEOTx3q18Knww1duqDmg=", - "zh:0a5d0f332d7dfe77fa27301094af98a185aabfb9f56d71b81936e03211e4d66f", - "zh:0e047859ee7296f335881933ccf8ce8c07aa47bef56d5449a81b85a2d9dac93a", - "zh:1d3d0896f518df9e245c3207ed231e528f5dcfe628508e7c3ceba4a2bfefaa7a", - "zh:1d7a31c8c490512896ce327ab220e950f1a2e30ee83cc2e58e69bbbfbbb87e72", - "zh:67cbb2492683cb22f6c54f26bee72aec140c8dd2d0881b2815d2ef80959fc751", - "zh:771062815e662979204ac2dc91c34c893f27670d67e02370e48124483d3c9838", - "zh:957ebb146898cd059c0cc8b4c32e574b61041d8b6a11cd854b3cc1d3baaeb3a9", - "zh:95dbd8634000b979213cb97b5d869cad78299ac994d0665d150c8dafc1390429", - "zh:a21b22b2e9d835e1b8b3b7e0b41a4d199171d62e9e9be78c444c700e96b31316", - "zh:aead1ba50640a51f20d574374f2c6065d9bfa4eea5ef044d1475873c33e58239", - "zh:cefabd0a78af40ea5cd08e1ca436c753df9b1c6496eb27281b755a2de1f167ab", - "zh:d98cffc5206b9a7550a23e13031a6f53566bd1ed3bf65314bc55ef12404d49ce", - "zh:dddaaf95b6aba701153659feff12c7bce6acc78362cb5ff8321a1a1cbf780cd9", - "zh:fd662b483250326a1bfbe5684c22c5083955a43e0773347eea35cd4c2cfe700e", + "h1:pr5qD16SxQqHEiaX+3kpQxQvQPedt5rhWCxc0aDmtqw=", + "zh:14b01d5d0f1185a350db10b3dd3096252369929ef691601da6a2855fba7f33fc", + "zh:2bdf86311961400b1ca23bc839460948e885f5751a90f4b4a38c1ca92ad8a86f", + "zh:3ff30141dd5be48677f059e5ba7e35a58d01559eeb7106ea5902d6cd94f08719", + "zh:4249ff7d5529a24b20fb5d8bc2c29cae734cd85b4da783060f97d2b6163edc3d", + "zh:55a19fa4380122c29623e182d765f909f2efbdc4326065905fa1576243e26b5e", + "zh:95102ed96e8c587b7d7906a5502ed004a2130026485446c81e1c99c46682403a", + "zh:9ad957a08e64b5dd56a61fc581452ad24d7372b6076111e301ef7f3dc9d9bb20", + "zh:9ff8702e2272badc586c91fdf65943064bcf3fff797797f0e503127418dc09f9", + "zh:ad7e1ddf64b400ef8b70ac2d91b3cbbc1e292cf6fe13cbfc36581c98f59ff53e", + "zh:b2ab8382a889dc6566d664d3ab9d46457819d4e01db9f62e4da55791507493a5", + "zh:b87607f98ec4b1b5a2c7f967cc246fb78eb4365e848750374e41f4d5e962a37d", + "zh:c54369ab37fee2570193cd6d703a852ebdcbdca067bae6c2bf169480d87fcf84", + "zh:e954a4294c114e3fa96365c65a8cfd7fbe9167bb325a03d17cc1d5332f209231", + "zh:f56f905fa60b4ceaefb1a9de99b158712633cfb8c445026c823e77c38f0af571", ] } diff --git a/main.tf b/main.tf index 016675d..80dc368 100644 --- a/main.tf +++ b/main.tf @@ -3,21 +3,7 @@ terraform { required_providers { hcloud = { source = "hetznercloud/hcloud" - version = "1.33.2" + version = "~> 1.35.0" } } } - -resource "hcloud_network" "this" { - name = var.name - ip_range = var.cidr -} - -resource "hcloud_network_subnet" "this" { - for_each = { for idx, val in var.subnets : idx => val } - - network_id = hcloud_network.this.id - network_zone = "???" - ip_range = each.value - type = "cloud" -} diff --git a/network.tf b/network.tf new file mode 100644 index 0000000..6acb702 --- /dev/null +++ b/network.tf @@ -0,0 +1,13 @@ +resource "hcloud_network" "this" { + name = var.name + ip_range = var.cidr +} + +resource "hcloud_network_subnet" "this" { + for_each = { for idx, val in var.subnets : idx => val } + + network_id = hcloud_network.this.id + network_zone = var.zone + ip_range = each.value + type = "cloud" +} diff --git a/variables.tf b/variables.tf index 1f17084..527e331 100644 --- a/variables.tf +++ b/variables.tf @@ -5,6 +5,13 @@ variable "name" { description = "Network Name" } +variable "zone" { + type = string + default = "eu-central" + sensitive = false + description = "Network Zone" +} + variable "cidr" { type = string default = ""