Multiple secondory cidr vpc_id issue

Hi Team

Since i am new to terraform and this community as well. So i am stuck on 1 point that i need to create multiple subnets with different CIDR Range, now how to get VPC ID from the secondory range.

If you know the CIDR block of the VPC:

data "aws_vpc" "selected" {
  cidr_block = "10.10.0.0/16"
}

cidr_block documentation.

If you don’t, either you need to find a method to derive it from the existing subnets or use a different argument for the data source (e.g. VPC ID, tags, state, etc.)

thanks for the response back.

1 Like