A dynamic Ansible inventory script that reads Terraform state files to connect to infrastructure across multiple cloud providers.
Terraform.py is a dynamic inventory script for Ansible that reads Terraform state files to automatically discover and connect to infrastructure resources across multiple cloud providers. It solves the problem of manually maintaining Ansible inventory files by dynamically generating them from Terraform's state, ensuring consistency between provisioned infrastructure and configuration management.
DevOps engineers and infrastructure teams using both Terraform for provisioning and Ansible for configuration management, particularly those managing multi-cloud environments.
Developers choose Terraform.py because it eliminates manual inventory management, reduces errors, and provides a seamless bridge between Terraform and Ansible with zero external dependencies and broad cloud provider support.
Ansible dynamic inventory script for parsing Terraform state files
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Out-of-the-box compatibility with AWS, GCP, Azure, and several other providers, enabling unified inventory across diverse infrastructure.
Runs solely on the Python standard library, ensuring easy deployment and portability without package management hassles.
Supports Terraform remote backends like S3, allowing inventory generation from centralized state files for team workflows.
Includes utilities like parse_attr_list for handling nested data, making it straightforward to add parsers for new cloud providers.
Requires precise tagging (e.g., sshUser, ssh_ip) in Terraform resources for Ansible connections, adding configuration complexity and potential for errors.
Inventory reflects only Terraform state file contents, so unapplied changes or external modifications won't be captured, leading to stale data.
While extensible, support is restricted to listed providers; adding unsupported ones demands custom Python coding, which can be time-consuming.
Usage involves wrapper scripts and specific directory structures, as shown in the README, which may confuse users unfamiliar with shell scripting or Ansible inventory conventions.