在提供程序中访问Terraform状态文件

I want to create a new provider for terraform. It is suppose to read the state files produced by Azure provider and create an Ansible inventory file out of it. I am using this guide as a base https://www.terraform.io/docs/extend/writing-custom-providers.html

These are my solutions until now:

  1. Reading the states JSON files with go.
  2. using depends_on = ["Azure.example"] in my Ansible provider and get access to variables how it is done here https://stackoverflow.com/a/45492093/4244999

How can I read the state files into a provider as variables with terraform functions?