Hello everyone,
Can you please help me incant a terraform module where I can feed multiple security group IDs to a "Security Group Rule". I am trying to create a terraform module such that I can give a list of security group IDs to it, and the security group rule will attach itself to each of the security group IDs. If I were to write it in pseudo code, it might look something like this:
<pseudo code>
security_group_ids=('sg-1234', 'sg-5678', 'sg-4321')
for sgid in ${security_group_ids[@]}; do
security_group_rule = 'some code that contains the rule here.'
attach ${security_group_rule} to ${sgid}
done
</pseudo code>
The infrastructure I'm trying to build contains VPCs, public and private subnets, security groups and taking advantage of the module/variable/output design pattern it is beautifully mainly fill in the blanks. I am now stuck only in the creation of the security group rule wherein I would like to call a single module and give that module a list of security group IDs for the security group rule to attach itself to.
I come from writing a Cloudformation/cloudformation-ruby-dsl infrastructure. As great as it is, I like terraform a lot! Thank you in advance.
p