Hi, in python aws I'm struggling creating subnets with ipv6_cidr_block (/64) from vpc (/56)
vpc = aws.ec2.Vpc(assign_generated_ipv6_cidr_block=True,...)
I'm looping over AZs
for idx, zone in enumerate(availability_zones.names):
aws.ec2.Subnet(...,
ipv6_cidr_block = vpc.ipv6_cidr_block.apply(lambda ipv6_block: assign_ipv6_cidr_block(idx,ipv6_block)))
using a utility function:
def assign_ipv6_cidr_block(subnet_idx, vpc_ipv6_cidr):
vpc_ipv6_network = ipaddress.IPv6Network(vpc_ipv6_cidr)
subnet_ipv6_cidr = list(vpc_ipv6_network.subnets(new_prefix=64))[subnet_idx]
return str(subnet_ipv6_cidr)
However, I get InvalidSubnet.Conflict, probably because this async stuff causes last value of idx to be used in the call to Subnet(... assign_ipv6_cidr_block(idx)).
So, how to fix this code using seperate values of idx (as in a sync world) - or even better use some pulumi built-in functions that just works. Thanks for your help