Skip to content

Commit

Permalink
fix: list length checking is a confirmed workaround for the Invalid C…
Browse files Browse the repository at this point in the history
…ount Argument error.

See hashicorp/terraform#26755
  • Loading branch information
valkenburg-prevue-ch committed Oct 5, 2023
1 parent ddb4db9 commit 1b65fd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ locals {
}
]...)

use_existing_network = can(var.existing_network_id[0])
use_existing_network = length(var.existing_network_id) > 0

# The first two subnets are respectively the default subnet 10.0.0.0/16 use for potientially anything and 10.1.0.0/16 used for control plane nodes.
# the rest of the subnets are for agent nodes in each nodepools.
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ variable "existing_network_id" {
# construction.
description = "If you want to create the private network before calling this module, you can do so and pass its id here. NOTE: make sure to adapt network_ipv4_cidr accordingly to a range which does not collide with your other nodes."
type = list(string)
default = null
nullable = true
default = []
nullable = false
validation {
condition = var.existing_network_id == null || (can(var.existing_network_id[0]) && length(var.existing_network_id) == 1)
error_message = "If you pass an existing_network_id, it must be enclosed in square brackets: [id]. This is necessary to be able to unambiguously distinguish between an empty network id (default) and a user-supplied network id."
Expand Down

0 comments on commit 1b65fd1

Please sign in to comment.