Open Lyannic opened 2 months ago
I think you are using a custom provider without specifying the provider_mapping
(#146).
Adding the following code to my terraform_state.yml
made it partially work:
hostnames:
- ipv4_address
provider_mapping:
- provider_name: registry.opentofu.org/hetznercloud/hcloud
types:
- hcloud_server
This does not use the ansible_host
resource, and you probably have to play around with the mapping.
SUMMARY
I can't read the inventory with the terraform_state plugin from a remote Terraform state that is stored at GitLab. The resources are created with the Hetzner Terraform provider. I don't get any error messages, but the resulting inventory is just empty.
ISSUE TYPE
COMPONENT NAME
cloud.terraform.terraform_state
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Ubuntu 22.04.4 LTS
STEPS TO REPRODUCE
I created a minimal example for my use-case.
main.tf
providers.tf
backend.tf
terraform_state.yml
EXPECTED RESULTS
An inventory with the server that I created in main.tf. Here is the result that I get from cloud.terraform.terraform_provider
terraform_provider.yml
Since I don't specify a state_file, terraform_provider is using the remote state too, which has the same config values as terraform_state.yml
terraform.tfstate
ACTUAL RESULTS
output from
ansible-inventory -vvvvvv -i terraform_state.yml --list