This message was deleted.
# python
s
This message was deleted.
b
nvm.. ip_network().subnet() returns iterator which has to be converted to list before taking any index from it
m
Copy code
private_subnets = []
for subnet in range(1, number_of_azs + 1):
    ec2_subnet = aws.ec2.Subnet(
        f"{env}-ec2Subnet-{subnet}-{suffix}",
        availability_zone=available_azs.names[subnet - 1],
        cidr_block=f"10.27.{subnet}.0/24",
        vpc_id=vpc.id,
        map_public_ip_on_launch=False,
        tags={
            "Type": "Private",
            "Name": f"{env}-ec2Subnet-{subnet}-private-{suffix}",
        },
        opts=pulumi.ResourceOptions(provider=provider),
    )
    private_subnets.append(ec2_subnet)
will this work? I need to get the subnet ids at the end..However I am still getting each element as type Output...