ansible / terraform-provider-ansible

community terraform provider for ansible
https://registry.terraform.io/providers/ansible/ansible/latest
GNU General Public License v3.0
183 stars 42 forks source link

specifies unknown plugin 'cloud.terraform.terraform_provider' #65

Closed dimi4ik closed 10 months ago

dimi4ik commented 10 months ago

Hello everyone,

As described in the blog post https://www.sysadminstories.com/2023/04/a-quick-look-at-terraform-provider-for.html, I have created the same Terraform deployment, but with a difference in the Azure cloud. I have created a Linux VM and then executed the following code:

`resource "ansible_host" "azu_instance" {
  name = azurerm_linux_virtual_machine.mylinuxvm.public_ip_address
  #groups = ["nginx_hosts"]
  variables = {
    ansible_user                 = "${var.ansible_user}",
    ansible_ssh_private_key_file = "${var.ansible_ssh_key}",
    #ansible_python_interpreter   = "${var.ansible_python}"
  }
  depends_on = [time_sleep.wait_20_seconds]
}

In the Azure portal, I am not getting a DNS name for the Linux VM, only an IP address, which I pass to the Ansible inventory file. I hope this is okay.

Unfortunately, I keep getting the same error:

[WARNING]:  * Failed to parse /inventory.yml with auto plugin: inventory config 'ansible_terraform_provider/v2/inventory.yml' specifies unknown plugin 'cloud.terraform.terraform_provider'
[WARNING]:  * Failed to parse ansible_terraform_provider/v2/inventory.yml with yaml plugin: Plugin configuration YAML file, not YAML inventory
[WARNING]:  * Failed to parse ansible_terraform_provider/v2/inventory.yml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed, this character is reserved to provide a port.
[WARNING]: Unable to parse ansible_terraform_provider/v2/inventory.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
I have already registered the Terraform provider:
Initializing provider plugins...
- terraform.io/builtin/terraform is built into Terraform
- Reusing the previous version of azure/azapi from the dependency lock file
- Reusing the previous version of ansible/ansible from the dependency lock file
- Reusing the previous version of hashicorp/azurerm from the dependency lock file
- Reusing the previous version of hashicorp/random from the dependency lock file
- Reusing the previous version of hashicorp/time from the dependency lock file
- Using the previously installed ansible/ansible v1.0.0
- Using the previously installed hashicorp/azurerm v3.72.0
- Using the previously installed hashicorp/random v3.5.1
- Using the previously installed hashicorp/time v0.9.1
- Using the previously installed azure/azapi v1.9.0

Thank you for any tips or a link to the solution for this issue.

dimi4ik commented 10 months ago

Now I found out This needs to be installed:

ansible-galaxy collection install cloud.terraform

Please please adapt the documentation.

dimi4ik commented 10 months ago

Now I found out This needs to be installed:

ansible-galaxy collection install cloud.terraform

Please please adapt the documentation.