Open james-valente-simplisafe opened 2 years ago
Perhaps when the conditional on line 318 fails, an else
block should revert or unset the loader
attributes that were set on lines 308 or 310?
Then, perhaps lines 377 to 379 will not fail with an error.
Alternatively, maybe remove the return nil, nil
on line 381 (leaving the condition as a warning), but letting the code fall back to the return cfg, nil
on line 384.
When a
~/.kube/config
file does not exist and thekubectl
provider block is not explicitly set with aload_config_file = "false"
, aterraform apply
will fail with the following error message.Creating an empty kubernetes config file will resolve this.
According to the documentation, when unspecified, the default value for
local_config_file
istrue
.I have both the
kubernetes
and thekubectl
providers configured exactly the same. Thekubernetes
provider works correctly. However, thekubectl
fails, as I have described above.I understand that setting
load_config_file = "false"
on thekubectl
provider will resolve the issue.However, I am opening this issue because there is a difference in behavior (with regard to configuration) between the
kubernetes
andkubectl
providers. My understanding is thatkubectl
is generally intended to match the configuration behavior of thekubernetes
provider. And, for the most part, both providers support nearly identical arguments.Perhaps there is a bug in the
kubectl
provider? With the default behavior ofload_config_file = "true"
, thekubectl
provider seems to be taking two different code paths, depending on whether the~/.kube/config
file exists or not. It defaults to an endpoint ofhttp://localhost/api?timeout=32s
when the file does not exist. However, if the file does exist (e.g. empty 0-byte file), thekubectl
provider seems to then respect the other configuration values ofhost
,cluster_ca_certificate
andtoken
arguments, with success.I turned on Terraform debugging, and the following messages seem to be related to the case where the
~/.kube/config
file does not exist.When I re-run, after creating an empty kube config, only the first debug line appears. The second line does not appear.
The code corresponding to the
DEBUG
lines above is here and here.Maybe this is caused by an uncaught error?
In any event, when the
~/.kube/config
file does not exist, perhaps thekubectl
provider should behave as thoughload_config_file
were set tofalse
, even if the default for that argument istrue
.Additional information ...
Terraform binary and provider versions:
I do not have any
KUBE_*
environment variables that would affect behavior.