https://pulumi.com logo
#python
Title
# python
a

astonishing-quill-88807

06/16/2020, 3:37 PM
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

echoing-breakfast-73834

06/16/2020, 3:43 PM
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

astonishing-quill-88807

06/16/2020, 3:56 PM
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 👍