adammck / terraform-inventory

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

Error reading tfstate: 0.12 error #144

Open nickelghost opened 4 years ago

nickelghost commented 4 years ago

Hello, the program is not working for me because of that error. I have a terraform.tfstate file generated with 0.12 in the directory where I'm running the command. The state includes one aws_instance. I'm on macOS Catalina.

 ~/Documents/Code/infrastructure   master ●  ansible --inventory-file=/usr/local/bin/terraform-inventory all -m ping
[WARNING]:  * Failed to parse /usr/local/bin/terraform-inventory with script plugin: Inventory script (/usr/local/bin/terraform-inventory) had an execution error: Error reading tfstate file: 0.12
format error: <nil>; pre-0.12 format error: <nil> (nil error means no content/modules found in the respective format)
[WARNING]:  * Failed to parse /usr/local/bin/terraform-inventory with yaml plugin: 'utf-8' codec can't encode characters in position 0-3: surrogates not allowed
[WARNING]:  * Failed to parse /usr/local/bin/terraform-inventory with ini plugin: /usr/local/bin/terraform-inventory:2: Expected key=value host variable assignment, got:
H__PAGEZEROx__TEXT�
[WARNING]: Unable to parse /usr/local/bin/terraform-inventory as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: embedded null byte
���� | FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}
justinas commented 4 years ago

I think this is a duplicate of https://github.com/adammck/terraform-inventory/issues/131

nickelghost commented 4 years ago

I wasn't sure so I created a separate issue