Replace deprecated datacenter by location for priamry-ips
Hetzner has changed it's API and removed the field `datacenter` from the
primary IPs in favor of `location`. This change reflex this and adjusts
the configuration accordingly. Note, that this change didn't require any
manual state changes. Instead I applied the former plan with the newest
provider once. Hence the provider already treated the fields correctly I
only had to adjust the configuration.
Chapeau Hetzner for this good transition!
See-also: 14da745f Update tofu-resources to their latest versions
Reference: https://docs.hetzner.cloud/changelog#2025-12-16-phasing-out-datacenters
This commit is contained in:
@@ -3,7 +3,7 @@ hetzner_cloud_apitoken = "YOUR_HETZNER_CLOUD_API_TOKEN"
|
|||||||
|
|
||||||
# Hetzner-locations: https://docs.hetzner.com/cloud/general/locations/
|
# Hetzner-locations: https://docs.hetzner.com/cloud/general/locations/
|
||||||
k8s_servers = [
|
k8s_servers = [
|
||||||
{ type = "cax11", location = "fsn1", ip_datacenter = "fsn1-dc14" }
|
{ type = "cax11", location = "fsn1" }
|
||||||
]
|
]
|
||||||
k8s_agents = [
|
k8s_agents = [
|
||||||
{ type = "cax11", location = "fsn1" }
|
{ type = "cax11", location = "fsn1" }
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ resource "hcloud_primary_ip" "ipv4" {
|
|||||||
count = length(var.servers)
|
count = length(var.servers)
|
||||||
|
|
||||||
name = "k8s_primary_ipv4_${count.index}"
|
name = "k8s_primary_ipv4_${count.index}"
|
||||||
datacenter = var.servers[count.index].ip_datacenter
|
location = var.servers[count.index].location
|
||||||
type = "ipv4"
|
type = "ipv4"
|
||||||
assignee_type = "server"
|
assignee_type = "server"
|
||||||
auto_delete = var.auto_delete_primary_ips
|
auto_delete = var.auto_delete_primary_ips
|
||||||
@@ -12,7 +12,7 @@ resource "hcloud_primary_ip" "ipv6" {
|
|||||||
count = length(var.servers)
|
count = length(var.servers)
|
||||||
|
|
||||||
name = "k8s_primary_ipv6_${count.index}"
|
name = "k8s_primary_ipv6_${count.index}"
|
||||||
datacenter = var.servers[count.index].ip_datacenter
|
location = var.servers[count.index].location
|
||||||
type = "ipv6"
|
type = "ipv6"
|
||||||
assignee_type = "server"
|
assignee_type = "server"
|
||||||
auto_delete = var.auto_delete_primary_ips
|
auto_delete = var.auto_delete_primary_ips
|
||||||
|
|||||||
@@ -8,9 +8,8 @@ variable "ssh_keys" {
|
|||||||
|
|
||||||
variable "servers" {
|
variable "servers" {
|
||||||
type = list(object({
|
type = list(object({
|
||||||
type = string
|
type = string
|
||||||
location = string
|
location = string
|
||||||
ip_datacenter = string
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,15 +34,13 @@ variable "ssh_keys" {
|
|||||||
|
|
||||||
variable "k8s_servers" {
|
variable "k8s_servers" {
|
||||||
type = list(object({
|
type = list(object({
|
||||||
type = optional(string, "cax11")
|
type = optional(string, "cax11")
|
||||||
location = string
|
location = string
|
||||||
ip_datacenter = string
|
|
||||||
}))
|
}))
|
||||||
description = <<EOF
|
description = <<EOF
|
||||||
The servers of the kubernetes-cluster.
|
The servers of the kubernetes-cluster.
|
||||||
This should always contain an off number of servers.
|
This should always contain an off number of servers.
|
||||||
An overview of locations can be found at: https://docs.hetzner.com/cloud/general/locations/
|
An overview of locations can be found at: https://docs.hetzner.com/cloud/general/locations/
|
||||||
Note, that the ip_datacenter has to match the location.
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user