fresh-angle-76971
08/14/2025, 5:33 PMproviders:
- name: pulumi
version: null # use whatever is in path
useNewPulumiVarfileSchema: true
- name: exec
preInit:
runScript: mise run get kubecontext
- name: kubernetes
dependencies:
- exec
preInit:
runScript: mise run write-kubeconfig
buildMode: cluster-buildkit
kubeconfig: ./infra/kubeconfig.yaml
context: ${providers.exec.outputs.initScript.log}
giving me the following error?
❯ garden validate --force-refresh
Validate ✔️
ℹ garden → Initializing...
ℹ garden → Running in environment dev.default in project pulumi
ℹ providers → Resolving providers (will force refresh statuses)...
ℹ exec → Configuring provider...
ℹ pulumi → Configuring provider...
✔ exec → Provider configured
✔ pulumi → Provider configured
ℹ exec → Running pre-init script
✔ pulumi → Provider is ready
ℹ exec → kubernetes-admin@huudot-dev-cluster
ℹ exec → Finished in 28.0ms
ℹ exec → Pre-init script completed successfully
✔ exec → Provider is ready
✖ providers → Failed processing resolve provider kubernetes (took 0.25 sec). This is what happened:
project.garden.yml:22
...
21 | kubeconfig: ./infra/kubeconfig.yaml
22 | context: ${providers.exec.outputs.initScript.log}
-------------------^
Could not find key initScript under providers.exec.outputs. Available keys: (none).
Failed resolving one or more providers:
- kubernetes
microscopic-river-74022
08/14/2025, 5:33 PMmicroscopic-river-74022
08/14/2025, 5:33 PM${providers.exec.outputs.initScript.log}
in your kubernetes
provider's context
field, but your exec
provider is using the preInit.runScript
field, not initScript
. According to the documentation, the output key initScript.log
is only populated when you use the initScript
field, not preInit.runScript
or preInit
fields. In your configuration, preInit.runScript
is set, so ${providers.exec.outputs.initScript.log}
is not available, resulting in the error:
> Could not find key initScript under providers.exec.outputs. Available keys: (none).
To fix this, you have two options:
1. Switch to using initScript
(if supported by your Garden version):
yaml
providers:
- name: exec
initScript: mise run get kubecontext
This will populate ${providers.exec.outputs.initScript.log}
as expected.
2. If you must use preInit.runScript
(recommended for newer versions):
The knowledge sources do not document an output variable for preInit.runScript
analogous to initScript.log
. Therefore, you cannot reference its output in the same way. You may need to adjust your workflow so that the value you need is written to a known file or environment variable, and reference that directly.
Summary:
The error is because ${providers.exec.outputs.initScript.log}
is only available when using initScript
, not preInit.runScript
. If you use preInit.runScript
, there is no documented output key you can reference in this way, according to the current knowledge sources [[Reference > Providers > exec – Outputs]()].microscopic-river-74022
08/14/2025, 5:33 PMpreInit.runScript
, you will need to find another way to pass that value to the kubernetes
provider, as the template variable you are using will not be populated.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
08/14/2025, 5:33 PMfresh-angle-76971
08/14/2025, 5:36 PMgarden validate --force-refresh
Validate ✔️
ℹ garden → Initializing...
ℹ garden → Running in environment dev.default in project pulumi
ℹ providers → Resolving providers (will force refresh statuses)...
ℹ exec → Configuring provider...
ℹ pulumi → Configuring provider...
✔ exec → Provider configured
✔ pulumi → Provider configured
✔ pulumi → Provider is ready
⚠ exec → Provider is not ready (only checking status)
✖ providers → Failed processing resolve provider kubernetes (took 0.13 sec). This is what happened:
project.garden.yml:21
...
20 | kubeconfig: ./infra/kubeconfig.yaml
21 | context: ${providers.exec.outputs.initScript.log}
-------------------^
Could not find key initScript under providers.exec.outputs. Available keys: (none).
microscopic-river-74022
08/14/2025, 5:36 PMmicroscopic-river-74022
08/14/2025, 5:36 PM${providers.exec.outputs.initScript.log}
template variable is only available if you have configured the initScript
field on the exec
provider. However, your error message indicates that even when using initScript
, the key is not available under providers.exec.outputs
.
The documentation confirms that the output key ${providers.exec.outputs.initScript.log}
should be available if initScript
is set on the exec
provider [[Reference > Providers > exec – Outputs]()]. If you are still seeing "Available keys: (none)" even with initScript
configured, there are a few possible reasons:
1. The initScript
field is not being picked up:
Double-check that your configuration is correct and that the initScript
field is at the correct indentation and under the correct provider.
2. Garden version mismatch:
The documentation notes that initScript
is deprecated in favor of preInit.runScript
in newer versions, but the output variable for preInit.runScript
is not documented. If you are using a version of Garden where initScript
is deprecated, it may not populate the output variable as expected.
3. No output is produced:
If the script does not produce any output, the log may be empty, but the key should still exist.microscopic-river-74022
08/14/2025, 5:36 PMinitScript
on the exec
provider and still see "Available keys: (none)", it suggests that either the field is not being recognized by your Garden version, or there is a configuration issue. The knowledge sources do not provide further troubleshooting steps or alternative output keys for preInit.runScript
. Therefore, based on the documentation, there is no other output key you can use for the result of preInit.runScript
or initScript
if it is not being populated [[Reference > Providers > exec – Outputs]()].
I'm sorry, but the knowledge sources do not contain enough information to resolve this issue beyond confirming the expected behavior for initScript
. If you continue to encounter this problem, you may need to consult Garden's support channels or issue tracker for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
08/14/2025, 5:36 PMfresh-angle-76971
08/14/2025, 6:00 PMinitScript
is working with garden deploy
even though it's not working with garden validate