fresh-angle-76971
08/13/2025, 9:20 AMkubeconfig
optional for the kubernetes provider with garden 0.14? When I set it to kubeconfig: ${var.kubeconfig || null}
I get the following error:
β providers β Failed processing resolve provider kubernetes (took 0.15 sec). This is what happened:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Error validating provider configuration:
kubeconfig must be a string
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β pulumi β Provider is ready
Failed resolving one or more providers:
- kubernetes
microscopic-river-74022
08/13/2025, 9:20 AMmicroscopic-river-74022
08/13/2025, 9:20 AMkubeconfig
field optional for the Kubernetes provider in Garden, you should use the optional template syntax by appending a ?
to the template string, like this:
yaml
providers:
- name: kubernetes
kubeconfig: ${var.kubeconfig}?
This syntax tells Garden to only set the value if var.kubeconfig
is defined; otherwise, it will omit the field, allowing Garden to fall back to the default behavior. This avoids the error you encountered (kubeconfig must be a string
), which happens when you explicitly set the value to null
instead of omitting it entirely.
This approach is documented for Garden 0.14 and earlier versions, and is the recommended way to make provider fields optional in your configurationΒ [Features > Variables and Templating > Optional values]().
Note: The logical OR fallback (${var.kubeconfig || null}
) is not appropriate for this use case, because the field expects a string or to be omitted, not null
. The ?
syntax is specifically designed for this scenario.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
08/13/2025, 9:20 AMmicroscopic-river-74022
08/13/2025, 9:22 AMmicroscopic-river-74022
08/13/2025, 9:22 AM?
(e.g., ${var.kubeconfig}?
) has been removed. The recommended approach is to use explicit fallback values with the logical OR operator, such as ${var.kubeconfig || null}
. However, as you observed, setting kubeconfig: ${var.kubeconfig || null}
results in an error because the field expects a string, not null
Β [Bonsai-0.13 Deprecations]().
The knowledge sources do not provide a direct solution for making kubeconfig
optional in Garden 0.14 when the variable is not set, without causing a type error. The documentation only states that the ?
syntax is deprecated and that you should use explicit fallback values, but in this case, using null
as a fallback is not accepted by the provider configuration validation.
Summary:
There is no documented way in the provided sources to make kubeconfig
optional in Garden 0.14 if the variable is not set, without causing a validation error. The removal of the ?
syntax and the type requirement for kubeconfig
(must be a string) create a gap that is not addressed in the current documentationΒ [Bonsai-0.13 Deprecations]().
If you need a workaround, you may need to ensure that var.kubeconfig
is always set to a valid string or restructure your configuration logic outside of Garden, but the knowledge sources do not provide a built-in solution for this scenario in 0.14.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
08/13/2025, 9:22 AMfresh-angle-76971
08/13/2025, 9:26 AMkubeconfig
field from a Helm Deploy
action?microscopic-river-74022
08/13/2025, 9:26 AMmicroscopic-river-74022
08/13/2025, 9:26 AMkubeconfig
field from within a Helm Deploy
action. The kubeconfig
field is documented as a configuration key for the Kubernetes provider itself, not for individual actions like Helm deploys. There is no mention of per-action overrides for this field in the provided documentationΒ [Reference > Providers > kubernetes > Configuration Keys]().
Based on the available documentation, it appears that kubeconfig
must be set at the provider level and cannot be overridden from a Helm Deploy
action.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
08/13/2025, 9:26 AMfresh-angle-76971
08/13/2025, 9:32 AMKUBECONFIG
env var if it only points to a single file: kubeconfig: ${var.kubeconfig || local.env.KUBECONFIG}