Closed ashleyghooper closed 1 year ago
Okay, I was able to fix my immediate issue by amending ansible.cfg
to include the ini
plugin as below:
[inventory]
enable_plugins = cloud.terraform.terraform_provider, ini
My next issue was this error on applying the playbook:
The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
On checking the Terraform debug logs and the generated .ini
inventory file in /tmp
, I saw the host vars I defined in my ansible_host
are not present. I'll log another issue for that.
Hi, I've got the provider working such that it's able to use the terraform state (in a storage bucket) as inventory. And when I run a simple playbook consisting of just a
ping
task it works:However, when using the
ansible_playbook
Terraform resource, the temporary inventory file that it generates seems to be invalid. Although Terraform reports no errors (and Terraform'sansible_playbook.playbook: Creating...
does not fail, but nor produces the expected playbook output), on reviewing my TF state file I see the below error:Project files
ansible.cfg
backend.tf
inventory.yml
main.tf
playbook.yml
Results
As mentioned, if I run the playbook directly everything works fine: