witty-spring-28765
05/09/2020, 8:13 PMbillowy-army-68599
ec2.get_subnet_ids
for this, here's a hastily thrown together example
import pulumi
from pulumi_aws import ec2
# get the default vpc
vpc = ec2.get_vpc(default=True)
# get subnets associated with the default vpc
subnets = ec2.get_subnet_ids(vpc_id=vpc.id)
export the subnet ids associated
pulumi.export("subnets", subnets.ids)
witty-spring-28765
05/10/2020, 10:31 AMimport pulumi
from pulumi_aws import ec2
# get the default vpc
vpc = ec2.get_vpc(default=False)
for i in vpc:
subnets = ec2.get_subnet_ids(vpc_id=i.id)
pulumi.export("subnets", subnets.ids)
Error:billowy-army-68599
witty-spring-28765
05/11/2020, 9:18 AMbillowy-army-68599
get_vpcs
to get all the VPCs in an account and loop through them
https://www.pulumi.com/docs/reference/pkg/python/pulumi_aws/ec2/#pulumi_aws.ec2.get_vpcs