Package: terrible
terribleTerrible (TERRaform to ansIBLE) creates dynamic Ansible inventory from Terraform
state.Free software: Apache Software License 2.0Documentation:https://terrible.readthedocs.io.InstallationTo install terrible, run this command in your terminal.:$ pip install terribleOnce installed a symbolic link or shell script can be added to the Ansible
inventory directory.Symbolic link.:$ ln -s /path/to/terrible inventory/terribleSimple shell script wrapper.:#!/usr/bin/env bash
terrible "$@"UsageUsage: terrible [OPTIONS] <root_dir>

  Terrible extracts Ansible inventory data from Terraform state. The
  <root_dir> is relative to the directory where Ansible is executed but
  defaults to ./terraform in the current directory.

Options:
  --host TEXT  Show varibles for single host
  --list       List all variables
  --nometa     Remove _meta from output
  --pretty     Make json look pretty
  --help       Show this message and exit.FeaturesTerraform Resources:VMware vSphere (vsphere_virtual_machine)AWS Instance (aws_instance)Common ParametersThese can be specified by all resources. Uniq configuration details are
documented in specific sections below.ansible_user(Optional)The user that Ansible will connect to the host. Defaults to root if not specified.ansible_group(Optional)The inventory group associated with the resource. (Add default All group?)ansible_host(Optional)The host that Ansible will connect to. VMware defaults to IP of 1st interface,network_interface:0but if can be overwriten to an specific IP. AWS
defaults topublic_ipand configuralbe toprivate_ip.
(TODO:  Add test and error condition for values)VMwareWhen defining Terraformvsphere_virtual_machineresource use thecustom_configuration_parametersblock to set Ansible parameters.Configuration example:custom_configuration_parameters {
  ansible_group = "api-gateway"
  ansible_user = "ansible"
  ansible_host = "192.168.52.101"
}AWSWhen defining a Terraformaws-instanceresource use tags to set Ansible
parameters.ansible_ssh_private_key_fileThe key used to connect to AWS instance. The value is the path to the private
key that matches the defined AWS instance key_name. Defaults to the value ofkey_name + .pem. EXAMPLE: If your AWS instance key_name isterraformthen Ansible would look in the current working directory for terraform.pemConfiguration example:tags {
  Name = "app1-aws"
  ansible_groups = "webapp"
  ansible_user = "ansible"
  ansible_host = "private_ip"
  ansible_ssh_private_key_file = "aws-keys/webapp-terraform.pem"
}Directory LayoutBy default, Terrible looks for theterraforminside the Ansible playbook root directory.:.
├── ansible.cfg
├── inventory
│   ├── group_vars
│   └── terrible
├── playbooks
│   └── site.yml
├── requirements.yml
├── roles
│   └── example_role
└── terraform
    ├── terraform.tf
    ├── terraform.tfstate
    ├── terraform.tfvars
    └── variables.tfCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.This package was greatly influenced by thesean-abbott/terraform.pyproject.History0.1.2 (2017-08-21)bump version testing0.1.1 (2017-08-21)Support foraws_instanceandvsphere_virtual_machineTerraform resources.Ansible parameters available: ansible_user, ansible_host, ansible_ssh_private_key_fileDefine Terraform resource to ansible group.0.1.0 (2017-08-10)First release on PyPI.