adammck / terraform-inventory

Terraform State → Ansible Dynamic Inventory
MIT License
1.82k stars 321 forks source link

Is it possible to combine static and dynamic inventories (or multiple inventories) with terraform-inventory? #107

Open queglay opened 5 years ago

queglay commented 5 years ago

Are there suggested best practices for combining multiple inventories with this tool?

I was reading this blog post about how to combine multiple inventories with similar tools to terraform-inventory. It suggests to point your inventory to a folder, and multiple inventory files will be combined. I'm not sure if its possible to do it here though, because terraform-inventory is an executable.

http://allandenot.com/devops/2015/01/16/ansible-with-multiple-inventory-files.html

DMarby commented 5 years ago

You can accomplish this by creating a script in the inventory folder that invokes terraform-inventory.

Here's an example that uses both terraform-inventory and a static inventory: https://github.com/DMarby/infrastructure/blob/master/ansible.cfg#L7 https://github.com/DMarby/infrastructure/tree/eb44681595a093a11b4d879e202ce08a496d06fb/ansible/inventory

queglay commented 5 years ago

Thanks, that's cool you can point it at a specific tfstate file.