<p>I have a Terraform config that (among other resources) creates a Google Kubernetes Engine cluster on Google Cloud. I'm using the <code>kubectl</code> provider to add YAML manifests for a ManagedCertificate and a FrontendConfig, since these are not part of the kubernetes or google providers.
This works as expected when applying the Terraform config from my local machine, but when I try to execute it in our CI pipeline, I get the following error for both of the <code>kubectl_manifest</code> resources:</p>
<pre><code>Error: failed to create kubernetes rest client for read of resource: Get &quot;http://localhost/api?timeout=32s&quot;: dial tcp 127.0.0.1:80: connect: connection refused
</code></pre>
<p>Since I'm only facing this issue during CI, my first guess is that the service account is missing the right scopes, but as far as I can tell, all scopes are present. Any suggestions and ideas are greatly appreciated!</p>

<p>Fixed the issue by adding <code>load_config_file = false</code> to the <code>kubectl</code> provider config. My provider config now looks like this:</p>
<pre><code>data &quot;google_client_config&quot; &quot;default&quot; {}

provider &quot;kubernetes&quot; {
  host                   = &quot;https://${endpoint from GKE}&quot;
  token                  = data.google_client_config.default.access_token
  cluster_ca_certificate = base64decode(CA certificate from GKE)
}

provider &quot;kubectl&quot; {
  host                   = &quot;https://${endpoint from GKE}&quot;
  token                  = data.google_client_config.default.access_token
  cluster_ca_certificate = base64decode(CA certificate from GKE)
  load_config_file       = false
}
</code></pre>
