https://pulumi.com logo
#general
Title
# general
d

dry-laptop-51353

09/11/2023, 8:30 AM
subnets = [] # Create subnets in each AZ (public and private) for i, cidr_block in enumerate(subnet_cidr_blocks): is_public = i % 2 == 0 # Alternating between public and private subnets subnet_type = "Public" if is_public else "Private" subnet = aws.ec2.Subnet( f"vpc-{subnet_type}-Subnet-{i}", availability_zone=f"{aws.get_availability_zones().names[i % num_azs]}", vpc_id=lpl_vpc.id, cidr_block=cidr_block, map_public_ip_on_launch=is_public, # Enable public IP for public subnets ) subnets.append(subnet) pulumi.export("subnets", subnets)
This is defined in vpc.py file and vpc is imported in main.py file where the cluster creation code is mentioed.