How can one generate a list that contains duplicate items from the original list?

With a count of 3 and the original list as [a, b, c, d], I aim to construct a repeated list producing the following output: [a, a, a, b, b, b, c, c, c, d, d, d]. How can this be accomplished in Terraform?

Hi @sheikhzainulabideen4,

You can use the range function to produce a list of a particular length containing consecutive integers.

If you combine range(3) with your original list using some combination of collection functions like flatten or setproduct and some for expressions then you should be able to derive a data structure like you’ve described.