If I supply the VPC ID as vpc_id and run plan I get the following:
Plan: 16 to add, 0 to change, 0 to destroy.
╷
│ Error: Invalid index
│
│ on .terraform/modules/sandbox_us_east.vpc.calculate_subnets_ipv6.subnet_calculator/main.tf line 2, in locals:
│ 2: cidr_netmask = tonumber(split("/", var.base_cidr_block)[1])
│ ├────────────────
│ │ var.base_cidr_block is ""
│
│ The given key does not identify an element in this collection value: the given index is greater than or equal to the length of the collection.
If I remove vpc_id and use cidr_block, I get the same error when trying to import the existing VPC.
tofu import module.sandbox_us_east.module.vpc.aws_vpc.main[0] vpc-xxxxxx
...
module.sandbox_us_east.module.vpc.aws_vpc.main[0]: Import prepared!
Prepared aws_vpc for import
module.sandbox_us_east.module.vpc.aws_vpc.main[0]: Refreshing state... [id=vpc-xxxxxxx]
...
│ Error: Invalid index
│
│ on .terraform/modules/sandbox_us_east.vpc.calculate_subnets_ipv6.subnet_calculator/main.tf line 2, in locals:
│ 2: cidr_netmask = tonumber(split("/", var.base_cidr_block)[1])
│ ├────────────────
│ │ var.base_cidr_block is ""
│
│ The given key does not identify an element in this collection value: the given index is greater than or equal to the length of the collection.
I am using tofu instead of terraform, but I didn't think that was the problem.
I'm trying to use this module to add transit subnets and attachment to my existing VPC.
If I supply the VPC ID as
vpc_id
and run plan I get the following:If I remove
vpc_id
and usecidr_block
, I get the same error when trying to import the existing VPC.I am using tofu instead of terraform, but I didn't think that was the problem.