How to interpolate terraform provider dependency on other provider

I know there is github issue around this ( https://github.com/hashicorp/terraform/issues/4149 ), but didn’t get the final solution in it, so posting here to get more clarity on it.

Basically we have terraform config ( chicken-egg problem )

provider bigip {
username = aws_network_interface.mgmt.private_ips

}
provider aws {

}
resource aws_network_interface mgmt {

}

So bigip provider depends on aws provider for ip address, and when we run above config it will end up in error saying provider bigip unable to connect the ip address as aws provider still not created instance and is in the middle of doing it.

Do kubernetes and helm, providers also have the same dependency problem which is resolved now.I looked into the code but didn’t get the workaround in the code.

I do see in the above code of using DefferedClient Loading function, will deferred client nodes solves the above issue ? or do we have to go with two stage approach of using terraform remote state ?

  1. To resolve this issue, what changes need to be done in provider bigip ( any logic/approach/reference ) will help a lot.
  2. Are there any providers implemented the solution for this ?

Many thanks

1 Like

I saw something in k8 provider about deferring client config in provider initialisation, ( https://github.com/hashicorp/terraformproviderkubernetes/blob/master/kubernetes/provider.go ) but not sure whether it will help in provider interpolation or not.

So i just tried deploying kubernetes cluster on azure by using azure,k8 provider with interpolation between them.( https://github.com/nicholasjackson/terraform-azure-k8s )

When i tried using above interpolation config, terraform apply went well up but failed spin the cluster, so i doubt the provider interpolation works or not.

But i do see some other examples provided in the providers with the interpolation ( example k8 cluster in GCP , https://github.com/hashicorp/terraform-provider-kubernetes/blob/master/_examples/google-gke-nfs-filestore/main.tf ) .