diff --git a/main.tf b/main.tf index 6b43e3f..26b23cd 100644 --- a/main.tf +++ b/main.tf @@ -13,8 +13,7 @@ locals { # The RFC 6052 "well known" NAT64 CIDR nat64_cidr = "64:ff9b::/96" - # In case we later decide to compute it - vpc_id = var.vpc_id + vpc_id = one(data.aws_vpc.default[*].id) ##################################################################### ## Determine the set of availability zones in which to deploy subnets @@ -271,7 +270,9 @@ data "aws_availability_zones" "default" { data "aws_vpc" "default" { count = local.need_vpc_data ? 1 : 0 - id = local.vpc_id + id = var.vpc_id + + tags = var.vpc_id } data "aws_eip" "nat" { diff --git a/variables.tf b/variables.tf index 6eb2e21..79ed848 100644 --- a/variables.tf +++ b/variables.tf @@ -1,6 +1,13 @@ variable "vpc_id" { type = string description = "VPC ID where subnets will be created (e.g. `vpc-aceb2723`)" + default = null +} + +variable "vpc_tags" { + type = map(string) + description = "VPC tags to get the VPC ID where subnets will be created" + default = null } variable "igw_id" {