I want to create vpc with amazaon provided ipv6 cidr_block and then create smaller subnet (/64, since amazon provided subnets are /56) and assign this smaller cidr_block to subnet inside vpc, below is my code, it throws an error
│ Error: “2406:da1a:415:1800::/56/64” is not a valid CIDR block: invalid CIDR address: 2406:da1a:415:1800::/56/64
│
│ with aws_subnet.dbvpczsrdstestvpcanil_cmcsubnetexternal_4F398891,
│ on cdk.tf.json line 415, in resource.aws_subnet.dbvpczsrdstestvpcanil_cmcsubnetexternal_4F398891:
│ 415: “ipv6_cidr_block”: “${aws_vpc.dbvpczsrdstestvpcanil_cmcvpc_10707888.ipv6_cidr_block}/64”,
Can someone look into the code and tell me how can i achieve the above requirement.
test_vpc=Vpc(
self,
"test-vpc",
cidr_block="10.10.0.0/16",
enable_dns_hostnames=True,
tags={**DEFAULT_TAGS, "Name": f"{stack_id}-test"},
assign_generated_ipv6_cidr_block=True,
)
Subnet(
self,
"subnet-external",
tags={**DEFAULT_TAGS_CMC, "Name": f"{stack_id}-external"},
cidr_block="10.10.0.0/16",
availability_zone="ap-south-1",
vpc_id=vpc.id,
map_public_ip_on_launch=False,
depends_on=[test_vpc],
ipv6_cidr_block=test_vpc.ipv6_cidr_block.split("/")[0] + "/64"
)