Skip to content

Commit

Permalink
fix(network): use coalesce to fix "The "count" value depends on resou…
Browse files Browse the repository at this point in the history
…rce attributes that cannot be determined until apply"
  • Loading branch information
mrclrchtr committed Mar 21, 2024
1 parent 628bef3 commit 64b6fee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "hcloud_network_subnet" "nodes" {
}

resource "hcloud_floating_ip" "control_plane_ipv4" {
count = var.enable_floating_ip && var.floating_ip_id == null ? 1 : 0
count = var.enable_floating_ip ? 1 : 0
name = "control-plane-ipv4"
type = "ipv4"
home_location = data.hcloud_location.this.name
Expand All @@ -30,7 +30,7 @@ resource "hcloud_floating_ip" "control_plane_ipv4" {

data "hcloud_floating_ip" "control_plane_ipv4" {
count = var.enable_floating_ip ? 1 : 0
id = var.floating_ip_id != null ? var.floating_ip_id : hcloud_floating_ip.control_plane_ipv4[0].id
id = coalesce(var.floating_ip_id, hcloud_floating_ip.control_plane_ipv4[0].id)
}

resource "hcloud_floating_ip_assignment" "this" {
Expand Down

0 comments on commit 64b6fee

Please sign in to comment.