Skip to content

Commit

Permalink
Fix up create_public_subnets=false
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjurkiewicz committed Mar 14, 2021
1 parent 666e7f9 commit 53c2dc5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions public.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module "public_label" {
locals {
public_enabled = local.enabled && var.create_public_subnets
public_subnet_count = local.public_enabled && var.max_subnet_count == 0 ? length(flatten(data.aws_availability_zones.available.*.names)) : var.max_subnet_count
public_route_expr_enabled = local.public_enabled && signum(length(var.vpc_default_route_table_id)) == 1
public_route_expr_enabled = signum(length(var.vpc_default_route_table_id)) == 1
public_network_acl_enabled = local.public_enabled && signum(length(var.public_network_acl_id)) == 0 ? 1 : 0
vpc_default_route_table_id = local.public_enabled ? signum(length(var.vpc_default_route_table_id)) : 0
}
Expand Down Expand Up @@ -64,13 +64,13 @@ resource "aws_route" "public" {
}

resource "aws_route_table_association" "public" {
count = local.public_route_expr_enabled ? 0 : local.availability_zones_count
count = local.public_enabled ? (local.public_route_expr_enabled ? 0 : local.availability_zones_count) : 0
subnet_id = element(aws_subnet.public.*.id, count.index)
route_table_id = aws_route_table.public[0].id
}

resource "aws_route_table_association" "public_default" {
count = local.public_route_expr_enabled ? local.availability_zones_count : 0
count = local.public_enabled ? (local.public_route_expr_enabled ? local.availability_zones_count : 0) : 0
subnet_id = element(aws_subnet.public.*.id, count.index)
route_table_id = var.vpc_default_route_table_id
}
Expand Down

0 comments on commit 53c2dc5

Please sign in to comment.