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

orange-tailor-85423

10/31/2018, 5:54 PM
does Pulumi have a way to index/iterate over a set of resources? I.e. GCLB routing rules.... figuring out how to make that a Pulumi resource/object that can be referenced as [0], [1] etc Terraform has the concept of 'count'
s

stocky-spoon-28903

10/31/2018, 5:57 PM
You can just create an array - one of the benefits of a ‘real’ language!
👍 3
To be more descriptive here, I often find myself doing things like:
Copy code
const cidrs = ["10.0.1.0/24", "10.0.2.0/24"]

const publicSubnets = cirds.map((cidr, index) => {
    return new aws.ec2.Subnet(`subnet-${index}`, {
         vpcId: "soemthing",
         cidrBlock: cidr
    });
});