This message was deleted.
# aws
s
This message was deleted.
a
Hmm maybe I have it working. Surely there is a better way than this though?
Copy code
let subnet = vpc.subnets.apply(subnets => {
    for (const sn of subnets) {
        
      let tagsCorrect = sn.tagsAll.apply(tags => {
        if (tags["SubnetType"] === "Public") {
          return true;
        } else {
          return false;
        }
      })

      let availabilityZoneCorrect = sn.availabilityZone.apply(az => {        
        if (az === zoneName) {
          return true;
        } else {
          return false;
        }
      })

      if (availabilityZoneCorrect && tagsCorrect) {
        return sn
      } else {
        console.log("Did not find subnet")
      }
    }
    return null;
  })
s
There's a
publicSubnetIds
and
privateSubnetIds
output on the VPC component. I believe they'll get generated in order, so your first AZ supplied should be the first ID in each subnetIds.