Closed oshankkumar closed 4 months ago
@abikouo, it appears that you've renamed 'ProvidersMapping' to 'PROVIDERS_CONFIG', which is causing a merge conflict with my pull request. Could you also take a look at my PR and make it happen? It would be great to be able to define custom providers.
ansible-collections/cloud.terraform#148 ansible-collections/cloud.terraform#146
Thanks,
SUMMARY
The inventory plugin cloud.terraform.terraform_state should accept required_providers source and version as input. I am using the azurerm backend provider with version 2.99.0. However, this plugin by default uses the latest azurerm version while building the inventory, resulting in an error when running terraform show while building the inventory.
ISSUE TYPE
COMPONENT NAME
plugin
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
Create an inventory plugin inventory.yml
Run the following command:
ansible-inventory -i inventory.yml --graph
An error is thrown:
This happens because the Terraform state file was built using an older version while the cloud.terraform.terraform_state plugin uses the latest version during terraform init. The plugin should accept input for required_providers source and version and use this information to write the Terraform version config which will be used during terraform init.