How to use kubernetes_service data provider in Terraform?
The provider documentation you quoted here seems to have a mistake. It talks about using the two providers together in the same module but it seems like it really means in the same configuration.
The problem arises because Terraform needs to configure a provider in order to plan with it, and so everything inside a provider &quot;kubernetes&quot; block must be known at the time of planning. This means you can't use anything in there which isn't created yet.
That documentation is trying to tell you that you'll need to split the configuration that declares your Kubernetes cluster from all of your configurations that configure or make use of the Kubernetes cluster, and then you can terraform apply the creation of the cluster first, and then separately terraform apply your other configurations that interact with it using the kubernetes provider.