faint-minister-59136
09/09/2025, 10:48 PMmicroscopic-river-74022
09/09/2025, 10:48 PMmicroscopic-river-74022
09/09/2025, 10:49 PMvariables key. You can also provide environment-specific overrides using the environments[].variables key.
2. Reference these variables in your ConfigMap deploy action using Garden's templating syntax, such as ${var.<key>}.
Here’s a step-by-step example:
1. Define project variables:
yaml
kind: Project
variables:
my-config-value: "default-value"
environments:
- name: dev
variables:
my-config-value: "dev-value"
- name: prod
variables:
my-config-value: "prod-value"
2. Use the variable in your ConfigMap deploy action:
yaml
kind: Deploy
type: configmap
name: my-configmap
spec:
data:
SOME_KEY: ${var.my-config-value}
With this setup, the value of SOME_KEY in your ConfigMap will be set according to the current environment: "dev-value" for the dev environment, "prod-value" for prod, and "default-value" otherwise. The templating engine will resolve ${var.my-config-value} to the appropriate value based on the environment you are deploying to.
This approach leverages Garden's variable and templating system, which supports referencing project and environment variables in action configurations, including ConfigMaps. You can also use nested keys and more complex structures as needed, using dot notation or bracketed lookups (e.g., ${var.some.nested.key} or ${var.some["nested"]["key"]}) [Features > Variables and Templating](), [Docs-edge > Reference > Action-types > Deploy > configmap Deploy]().microscopic-river-74022
09/09/2025, 10:49 PM