Skip to content

Commit

Permalink
Revert "Use coalescelist instead"
Browse files Browse the repository at this point in the history
The ternary operator uses short-circuiting, whereas `coalescelist` always evaluates `module.vpc[0].private_subnets` and fails if `module.vpc[0]` doesn't exist.
  • Loading branch information
manics committed Apr 24, 2024
1 parent 4c92a0a commit f16c4a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ecs-cluster/keycloak.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ locals {
keycloak-hostname = var.keycloak-hostname == "" ? aws_lb.keycloak.dns_name : var.keycloak-hostname

vpc_id = var.vpc-id == "" ? module.vpc[0].vpc_id : var.vpc-id
public_subnets = coalescelist(var.public-subnets, module.vpc[0].public_subnets)
private_subnets = coalescelist(var.private-subnets, module.vpc[0].private_subnets)
public_subnets = length(var.public-subnets) == 0 ? module.vpc[0].public_subnets : var.public-subnets
private_subnets = length(var.private-subnets) == 0 ? module.vpc[0].private_subnets : var.private-subnets
}

resource "random_password" "db-password" {
Expand Down

0 comments on commit f16c4a1

Please sign in to comment.