<p>I am trying to create a CI build in Github Actions for Kubernetes deployment with Terraform on Minikube. The Terraform apply fails on deploying provider with following message:</p>
<pre><code>Invalid attribute in provider configuration

  with provider[&quot;registry.terraform.io/hashicorp/kubernetes&quot;],
  on providers.tf line 18, in provider &quot;kubernetes&quot;:
  18: provider &quot;kubernetes&quot; {

'config_path' refers to an invalid path: &quot;/github/home/.kube/config&quot;: stat
/github/home/.kube/config: no such file or directory
</code></pre>
<p>How can I resolve it? I have tried various approaches but so far nothing works. Everything works fine when I deploy it locally with Minikube.</p>
<p>Relevant code snippets from Terraform:</p>
<p>variables.tf:</p>
<pre><code>variable &quot;kube_config&quot; {
  type    = string
  default = &quot;~/.kube/config&quot;
}
</code></pre>
<p>providers.tf:</p>
<pre><code>provider &quot;kubernetes&quot; {
  config_path    = pathexpand(var.kube_config)
  config_context = &quot;minikube&quot;
}
</code></pre>
<p>Github Actions job:</p>
<pre><code>jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: setup minikube
      uses: manusa/actions-setup-minikube@v2.7.2
      with:
        minikube version: 'v1.28.0'
        kubernetes version: 'v1.25.4'
        github token: ${{ secrets.GITHUB_TOKEN }}
        driver: docker
        container runtime: docker

    - name: terraform-apply
      uses: dflook/terraform-apply@v1.29.1
      with:
          path: terraform-k8s
          auto_approve: true
</code></pre>
<p>I have also tried running it with official setup-minikube action, but doesn't work as well.</p>

RSK RSK
<p>Seems like I have managed to make it work by using official Hashicorp's action instead of the original. Gonna check if it deploys everything in the end :)</p>
<pre><code>    - uses: hashicorp/setup-terraform@v2   
    - name: terraform-init
      run: terraform -chdir=terraform-k8s init
    - name: terraform-apply
      run: terraform -chdir=terraform-k8s apply -auto-approve 
</code></pre>
