sparse-intern-71089
01/03/2024, 6:56 PMhallowed-fireman-90476
01/04/2024, 2:56 AMprivate_route_table_details = mws_vpc.route_tables.apply(
lambda route_tables: [
private_id
for route in route_tables
if (
private_id := route.tags.apply(
lambda tag: route.id
if tag["SubnetType"] == "Private"
else None
)
)
],
)
But list contain <null> which i cannot remove it with None or "null", "" checkgreen-stone-37839
01/04/2024, 6:47 PMhallowed-fireman-90476
01/05/2024, 2:42 PMgreen-stone-37839
01/05/2024, 2:51 PMgreen-stone-37839
01/09/2024, 12:18 AMfunction GetPrivateVpcs(rts: aws.ec2.RouteTable[]): pulumi.Output<aws.ec2.RouteTable | undefined>[] {
const privateRts: pulumi.Output<aws.ec2.RouteTable | undefined>[] = [];
for (const rt of rts) {
const localRt = rt.tags.apply(tag => {
if (tag!["SubnetType"] == "Private") {
console.log("Private");
console.log(`length: ${privateRts.length}`);
return rt;
}
return undefined;
});
privateRts.push(localRt);
}
return privateRts;
}
const vpc = new awsx.ec2.Vpc("vpc", {
cidrBlock: "10.100.0.0/16"
});
export const privateRts = vpc.routeTables.apply(GetPrivateVpcs);
green-stone-37839
01/09/2024, 12:19 AMfunction GetPrivateVpcs(
rts: aws.ec2.RouteTable[]
): pulumi.Output<aws.ec2.RouteTable[]> {
// Resolve all outputs first, then filter within the apply.
return pulumi
.all(
rts.map((rt) =>
rt.tags.apply((tags) => ({
rt,
tags,
}))
)
)
.apply((unwrapped) => {
const privateRts: aws.ec2.RouteTable[] = [];
for (const rt of unwrapped) {
if (rt.tags!["SubnetType"] == "Private") {
console.log("Private");
console.log(`length: ${privateRts.length}`);
privateRts.push(rt.rt);
}
}
return privateRts;
});
}