So, continuing on the trend of difficulties with O...
# python
a
So, continuing on the trend of difficulties with Output objects, I'm trying to generate IPv6 subnets from the CIDR block of the created VPC using the vpc.ipv6_cidr_block output attribute and passing that into an
ipaddress.IPv6Network
call which is throwing errors about the type being invalid. I've tried using the
.apply
approach which doesn't seem to be working since the return value of an apply is still an Output object. How do I just access the underlying string to create the network object?
e
Where "cidr_block" is an
Output
object that'll eventually return a string:
cidr_block.apply(lambda value: ip_network(cidr_block).subnets(prefixlen_diff=2))
This will return an Output object that will eventually return a List[IPv6Network] object, where each IPv6Network is a subnet of cidr_block that's 1/4 the original size
a
Thanks! I had to massage it a bit to make it output a list instead of a generator, but it got me there in the end 👍