Skip to content

Commit

Permalink
reference local.vpc instead of aws_vpc in local.cidr_block
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianeib committed May 22, 2023
1 parent ddf1f30 commit ffb5715
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ locals {
# # if var.vpc_id is passed, assume create = `false` and cidr comes from data.aws_vpc
create_vpc = var.vpc_id == null ? true : false
vpc = local.create_vpc ? aws_vpc.main[0] : data.aws_vpc.main[0]
cidr_block = var.cidr_block == null ? aws_vpc.main[0].cidr_block : var.cidr_block
cidr_block = var.cidr_block == null ? local.vpc.cidr_block : var.cidr_block

create_flow_logs = (var.vpc_flow_logs == null || var.vpc_flow_logs.log_destination_type == "none") ? false : true

# IPv6 ############################################################
# Ipv6 cidr block (To change when multiple Ipv6 CIDR blocks)
vpc_ipv6_cidr_block = var.vpc_ipv6_cidr_block == null ? aws_vpc.main[0].ipv6_cidr_block : var.vpc_ipv6_cidr_block
vpc_ipv6_cidr_block = var.vpc_ipv6_cidr_block == null ? local.vpc.ipv6_cidr_block : var.vpc_ipv6_cidr_block
# Checking if public subnets are dual-stack or IPv6-only
public_ipv6only = can(var.subnets.public.ipv6_native)
public_dualstack = !local.public_ipv6only && (can(var.subnets.public.assign_ipv6_cidr) || can(var.subnets.public.ipv6_cidrs))
Expand Down

0 comments on commit ffb5715

Please sign in to comment.