In order to pass a list to helm using the terraform helm_release provider, you can use the list
type in your values
block. Here is an example:
resource "helm_release" "my_release" {
name = "my-release"
repository = "https://charts.example.com/"
chart = "my-chart"
values = {
my_list = list("item1", "item2", "item3")
}
}
In this example, we are passing a list called my_list
that contains three items to the helm chart. Note that we are using the list
function to create the list with the three items. You can replace the items with variables or other expressions if needed.
Once you have your list defined in the values
block, you can access it in your helm chart templates using the lookup
function. For example, to iterate over the list in a range
block, you can use the following code:
{{- range $i, $item := (lookup .Values "my_list") }}
{{ printf "Item %d: %s" $i $item }}
{{- end }}
This will output the three items in the list with their corresponding index.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-08-23 11:00:00 +0000
Seen: 10 times
Last updated: May 11 '21
How to incorporate Knative service and Contour in conjunction with Ingress?
Is it possible to utilize both kustomize and helm?
How can excessive inputs to SQLite jdbc db lead to memory congestion?
What are the steps to utilize Keda Scaledobjects to deploy Azure functions on AKS?
How can PHP be used to implement Server-Sent Events?
How can clipping planes be used to clip troika-three-text in Three.js?
What is the method to extract key-value pairs from an array of objects that require multiple lines?