You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to create private subnets without using additional keywords such as database_subnets or elasticache_subnets, but for some reason terraform gives me this error: Error: creating EC2 VPC: InvalidParameterValue: The allocation size is too big for the pool. status code: 400, request id: 4b211e71-05f7-474c-90f3-ef3f43e4a3ba
locals {
partition = cidrsubnets(data.aws_vpc_ipam_preview_next_cidr.previewed_cidr.cidr, 1, 2, 3, 3) # result = 3 Sub CIDRs with prefixes 25, 26, 27, 27
cidrsubnet_public = cidrsubnets(local.partition[2], 1, 1) # Result = 1 Sub CIDR with prefix 28
cidrsubnet_wld = cidrsubnets(local.partition[0], 1, 1) # Result = 1 Sub CIDR with prefix 26
cidrsubnet_data = cidrsubnets(local.partition[1], 1, 1) # Result = 1 Sub CIDR with prefix 27
cidrsubnet_tgw = cidrsubnets(local.partition[3], 1, 1) # Result = 1 Sub CIDR with prefix 28
azs = formatlist("${data.aws_region.current.name}%s", ["a", "b"])
cidrsubnet_private = tolist(concat(local.cidrsubnet_wld, local.cidrsubnet_data, local.cidrsubnet_tgw))
}
locals {
vpc_name = "xxxxxx"
public_subnet_name = "public_subnet"
}
locals {
private_subnet_workload_name = [for value in local.azs : join("-", [value, "workload_subnet"])]
private_subnet_datatier_name = [for value in local.azs : join("-", [value, "datatier_subnet"])]
private_subnet_tgw_name = [for value in local.azs : join("-", [value, "transit_gateway_subnet"])]
private_subnets_all_names = tolist(concat(local.private_subnet_workload_name, local.private_subnet_datatier_name, local.private_subnet_tgw_name))
}
Expected behavior
create 2 AZ, each AZ has 3 private & 1 public subnet. In total 8 subnets
Actual behavior
Only VPC was created
Terminal Output Screenshot(s)
Error: creating EC2 VPC: InvalidParameterValue: The allocation size is too big for the pool. status code: 400, request id: 4b211e71-05f7-474c-90f3-ef3f43e4a3ba
Additional context
But when I add database_subnet_names, elasticache_subnet_names to seperate the private subnet names. It works
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
ipv4_ipam_pool_id = data.aws_vpc_ipam_pool.ipv4_prod.id
cidr = data.aws_vpc_ipam_preview_next_cidr.previewed_cidr.cidr
database_subnets = local.cidrsubnet_data
elasticache_subnets = local.cidrsubnet_tgw
private_subnets = local.cidrsubnet_wld
public_subnets = local.cidrsubnet_public
name = local.vpc_name
azs = local.azs
public_subnet_names = [for value in local.azs : join("-", [value, local.public_subnet_name])]
private_subnet_names = [for value in local.azs : join("-", [value, local.private_subnet_workload_name])]
database_subnet_names = [for value in local.azs : join("-", [value, local.private_subnet_datatier_name])]
elasticache_subnet_names = [for value in local.azs : join("-", [value, local.private_subnet_tgw_name])]
}
locals {
partition = cidrsubnets(data.aws_vpc_ipam_preview_next_cidr.previewed_cidr.cidr, 1, 2, 3, 3) # result = 3 Sub CIDRs with prefixes 25, 26, 27, 27
cidrsubnet_public = cidrsubnets(local.partition[2], 1, 1) # Result = 1 Sub CIDR with prefix 28
cidrsubnet_wld = cidrsubnets(local.partition[0], 1, 1) # Result = 1 Sub CIDR with prefix 26
cidrsubnet_data = cidrsubnets(local.partition[1], 1, 1) # Result = 1 Sub CIDR with prefix 27
cidrsubnet_tgw = cidrsubnets(local.partition[3], 1, 1) # Result = 1 Sub CIDR with prefix 28
azs = formatlist("${data.aws_region.current.name}%s", ["a", "b"])
}
locals {
vpc_name = "xxxxxx"
public_subnet_name = "public_subnet"
}
locals {
private_subnet_workload_name = "workload_subnet"
private_subnet_datatier_name = "datatier_subnet"
private_subnet_tgw_name = "transit_gateway_subnet"
}
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
Hi,
I want to create private subnets without using additional keywords such as database_subnets or elasticache_subnets, but for some reason terraform gives me this error: Error: creating EC2 VPC: InvalidParameterValue: The allocation size is too big for the pool. status code: 400, request id: 4b211e71-05f7-474c-90f3-ef3f43e4a3ba
Versions
Module version [omitted]:
Terraform version:
Reproduction Code [Required]
Expected behavior
create 2 AZ, each AZ has 3 private & 1 public subnet. In total 8 subnets
Actual behavior
Only VPC was created
Terminal Output Screenshot(s)
Error: creating EC2 VPC: InvalidParameterValue: The allocation size is too big for the pool. status code: 400, request id: 4b211e71-05f7-474c-90f3-ef3f43e4a3ba
Additional context
But when I add
database_subnet_names
,elasticache_subnet_names
to seperate the private subnet names. It worksThe text was updated successfully, but these errors were encountered: