mantl / terraform.py

Ansible dynamic inventory script for parsing Terraform state files
Apache License 2.0
451 stars 122 forks source link

Allow connection by IP also #45

Open ghost opened 8 years ago

ghost commented 8 years ago

I have noticed that by default I have to connect by DNS name (using digitalocean_droplet); it would be nice to be able to pass a switch (maybe --ipv4) and connect directly by IP instead of using DNS.

This is a problem because if you directly provision with TF and then try to run ansible using terraform.py as the "dynamic inventory" you're not able to connect because the DNS records do not exist.

sean-abbott commented 8 years ago

+1

sean-abbott commented 8 years ago

Along with #47, where I suggested config options, I would like to default to private IP without needing any tags.

sean-abbott commented 8 years ago

I modified the name assignment of aws_host to achieve this in a hacked fashion:

name = resource['primary']['attributes']['private_ip']

But a more permanent solution would be nice.

stevendborrelli commented 8 years ago

I agree with this. It would be nice to have the option of using private IPs.

We probably also need to rethink options so that ENV vars can be used, since ansible will not send arguments down to the inventory script.

sean-abbott commented 8 years ago

ENV vars are ok, but would prefer config options from a code-sharing standpoint. I find things that require you source env vars before running to be more fraught with peril than stuff that allows you give a one liner to your coworkers.