hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.

Home Page:https://www.terraform.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Access to count index attribute might be required by some providers

c4milo opened this issue · comments

When using count to create multiple copies from a resource definition. If the resource creates some sort of caching directory, there is no way for the provider to know which directory belongs to which resource instance.

A particular example is a resource "virtual_machine" that downloads its virtual disks somewhere to the file system. Assuming the provider will not download again the disks if they already exist. Having count greater than 1 would cause all the resources to use the same virtual disks which would be undesirable. That said, it would be great if there is some way of knowing which "virtual machine" from the pool I'm dealing with, from a provider perspective.

Please let me know if you need me to elabore further. #111 may be related to this issue.

Any updates on this? Would like to be able to set the hostname based on index count.

@mitchellh any update on this?

Highly desired enhancement.

This should be possible soon with the branch I'm working on dynamic-subgraph.

Great, looking forward to it. Thanks for the effort!

Done with #355. See there for docs too.