Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Terraform's helm_release, how do I set array or list values?

For example, per the helm chart documentation for Drupal, the default value for accessModes is ["ReadWriteOnce"] which translates to the following in the YAML:

...
accessModes
- ReadWriteOnce

When using the Terraform helm_release resource, the following do not work and the yaml file always shows the default from above:

  set {
    name  = "persistence.accessModes"
    value = "ReadWriteMany"
  }
  set {
    name  = "persistence.accessModes"
    value = "[\"ReadWriteMany\"]"
  }
  set {
    name  = "persistence.accessModes"
    value = "- ReadWriteMany"
  }
like image 983
user658182 Avatar asked Aug 25 '26 22:08

user658182


1 Answers

You would set it the same way as with the helm CLI --set flag. For example, using the index notation.

As of Helm 2.5.0, it is possible to access list items using an array index syntax. For example, --set servers[0].port=80

set {
  name  = "persistence.accessModes[0]"
  value = "ReadWriteMany"
}

The alternative syntax is using curly braces. Where you can add the list items separated with a comma between the braces.

Lists can be expressed by enclosing values in { and }. For example, --set name={a, b, c}

set {
  name  = "persistence.accessModes"
  value = "{ReadWriteMany}"
}
like image 134
The Fool Avatar answered Aug 29 '26 09:08

The Fool



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!