anonymous user
anonymous user

Reputation: 317

How to use multiple count in same block in terraform

My variables.tf is having required variables:

I have the a block in terraform code which has variable count defined. I need to run through a for loop which should start with index based on count.index value and iterate through var1 number of times.

I could not fit in with for_each or for because I need to iterate through a count. But there is already a count variable defined in the same block so I cannot define another count within the block.

It would be really helpful if someone help me with this. Thanks in advance!

Upvotes: 0

Views: 1041

Answers (1)

anonymous user
anonymous user

Reputation: 317

Successfully I am able to achieve the use case I described using range function terraform. Eg- pseudo code:

for n in range(var.private_count) : "output_value" => join(",",openstack_networking_floatingip_v2.floatip[required_index+i].address }

Upvotes: 0

Related Questions