Hello, Can some one please take a look at code and...
# python
h
Hello, Can some one please take a look at code and help me out. I am creating a simple vpc. I have a for loop that creates subnet route table association. ever time i run pulumi up. pulumi recreates the route table associations Here is the code
Copy code
private_subnet_ids = []
Copy code
private_subnet_2 = aws.ec2.Subnet(
    "app-subnet-2",
    vpc_id=vpc_id,
    availability_zone="us-west-2b",
    cidr_block="10.100.2.0/24",
    map_public_ip_on_launch = 'false',
    # Only assign public IP if we are exposing public subnets
    tags={
        "Name": "app-subnet-2",
    },)
private_subnet_ids.append(private_subnet_2)
Copy code
for psubnet in private_subnet_ids:
    passociationname = str(psubnet.id) + "route_table_association"
    passociationname = aws.ec2.RouteTableAssociation(
    passociationname,
    subnet_id = psubnet.id,
    route_table_id = private_route_table.id,
    )