I read https://blog.gruntwork.io/terraform-tips-tricks-loops-if-statements-and-gotchas-f739bbae55f9 and others, but I still couldn’t understand how I can iterate over two lists. For example, I have a list of 10 names. I need to create 10 S3 buckets, 10 AWS Transfer servers, and 20 users, 2 per server (readonly and readwrite).
After I created S3 buckets and Transfer servers, I have two lists…
My pseudo code is like this (in bash now), but I want to implement this end-to-end flow in Terraform :
for(i=0; i<10; i++) do something for bucket[i] create some IAM policies do something for server[i] create readonly user for bucket[i] create readwrite user for bucket[i] end