on terraform plan
╷
│ Error: “10.10.0.1/22” is not a valid IPv4 CIDR block; did you mean “10.10.0.0/22”?
│
│ with module.vpc.aws_subnet.public_subnet[0],
│ on …/modules/vpc/main.tf line 19, in resource “aws_subnet” “public_subnet”:
│ 19: cidr_block = element(var.public_subnets_cidr, count.index)
This is my subnet details
variable "public_subnets_cidr" {
type = list(any)
description = "CIDR block for Public Subnet"
default = ["10.10.0.1/22"]
}
the usage in main.tf
# Public subnet
resource "aws_subnet" "public_subnet" {
vpc_id = aws_vpc.vpc.id
count = length(var.public_subnets_cidr)
cidr_block = element(var.public_subnets_cidr, count.index)
availability_zone = element(var.availability_zones, count.index)
map_public_ip_on_launch = true
tags = {
Name = "${var.env}-${element(var.availability_zones, count.index)}-public-subnet"
Environment = "${var.env}"
}
}