Alternatives to terraform inventory

Hey everyone, this is my first post here.

I’m looking at alternative means to provide a dynamic inventory of my terraform infrastructure to ansible so that I can provision everything easily.

I’ve been running into issues with terraform-inventory in .12, and I’m wondering what other options there are that people would be able to recommend!

Hi @queglay!

I don’t have a suggestion for a ready-to-go answer, but the terraform show -json command added in Terraform 0.12 prints out the current state contents in a documented format which you could hopefully transform into a suitable shape for Ansible’s consumption using a small program.

No worries Martin, thanks for the suggestion. I made a playbook to add and update hosts ip’s, and add to a group in an inventory file after they are launched and its working fine so far for the basic functions needed.

In case anyone else needs it-

…and accompanying bash script needed because lineinfile wasn’t able to give me what I needed-