Managing Microk8s with Terraform

I’ve used terraform to setup microk8s on an ec2 instance and would like to configure terraform to use kubernetes provider.

The terraform apply is run from a CI/CD service and has AWS credentials. If necessary I can provide the credentials from microk8s config to terraform.
What would be the best way to configure kubernetes provider for terraform to access/manage microk8s?

To get the kubeconfig i do it from terraform. I did one terraform + MicroK8s on DigitalOcean.

Shameless plug https://github.com/balchua/do-microk8s

Hopefully you can get something from it.