mirror of
https://github.com/2martens/terraform.git
synced 2026-10-17 13:36:51 +02:00
fix: Use element function for its index overshoot capability
This commit is contained in:
@@ -3,8 +3,8 @@ resource "hcloud_load_balancer" "docker" {
|
||||
|
||||
load_balancer_type = var.loadbalancer_type
|
||||
name = format("%s_%s", "docker", var.stage_name)
|
||||
location = var.locations[count.index].name
|
||||
network_zone = var.locations[count.index].network_zone
|
||||
location = element(var.locations.*.name, count.index)
|
||||
network_zone = element(var.locations.*.network_zone, count.index)
|
||||
algorithm {
|
||||
type = "round_robin"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ resource "hcloud_primary_ip" "ipv4_node_address" {
|
||||
count = var.number_nodes
|
||||
|
||||
name = format("%s_%s_%s_%d", "docker", var.stage_name, "ipv4", count.index)
|
||||
datacenter = var.locations[count.index].datacenter_name
|
||||
datacenter = element(var.locations.*.datacenter_name, count.index)
|
||||
type = "ipv4"
|
||||
assignee_type = "server"
|
||||
auto_delete = false
|
||||
@@ -20,7 +20,7 @@ resource "hcloud_primary_ip" "ipv6_node_address" {
|
||||
count = var.number_nodes
|
||||
|
||||
name = format("%s_%s_%s_%d", "docker", var.stage_name, "ipv6", count.index)
|
||||
datacenter = var.locations[count.index].datacenter_name
|
||||
datacenter = element(var.locations.*.datacenter_name, count.index)
|
||||
type = "ipv6"
|
||||
assignee_type = "server"
|
||||
auto_delete = false
|
||||
@@ -49,7 +49,7 @@ resource "hcloud_server" "node" {
|
||||
image = var.image_name
|
||||
allow_deprecated_images = false
|
||||
server_type = var.server_type
|
||||
location = var.locations[count.index].name
|
||||
location = element(var.locations.*.name, count.index)
|
||||
|
||||
public_net {
|
||||
ipv4_enabled = true
|
||||
|
||||
@@ -2,7 +2,7 @@ resource "hcloud_primary_ip" "ipv4_worker_node_address" {
|
||||
count = var.number_worker_nodes
|
||||
|
||||
name = format("%s_%s_%s_%s_%d", "docker", "worker", var.stage_name, "ipv4", count.index)
|
||||
datacenter = var.locations[count.index].datacenter_name
|
||||
datacenter = element(var.locations.*.datacenter_name, count.index)
|
||||
type = "ipv4"
|
||||
assignee_type = "server"
|
||||
auto_delete = false
|
||||
@@ -20,7 +20,7 @@ resource "hcloud_primary_ip" "ipv6_worker_node_address" {
|
||||
count = var.number_worker_nodes
|
||||
|
||||
name = format("%s_%s_%s_%s_%d", "docker", "worker", var.stage_name, "ipv6", count.index)
|
||||
datacenter = var.locations[count.index].datacenter_name
|
||||
datacenter = element(var.locations.*.datacenter_name, count.index)
|
||||
type = "ipv6"
|
||||
assignee_type = "server"
|
||||
auto_delete = false
|
||||
@@ -49,7 +49,7 @@ resource "hcloud_server" "worker_node" {
|
||||
image = var.image_name
|
||||
allow_deprecated_images = false
|
||||
server_type = var.server_type
|
||||
location = var.locations[count.index].name
|
||||
location = element(var.locations.*.name, count.index)
|
||||
|
||||
public_net {
|
||||
ipv4_enabled = true
|
||||
|
||||
Reference in New Issue
Block a user