https://garden.io logo
#🌱|help-and-getting-started
Invalid template string
# 🌱|help-and-getting-started
c

chilly-waitress-62592

02/09/2023, 3:37 PM
Somewhat confused as to why I'm receiving an error on this really simple template string. This is being used in the
values
section of a helm module.
"${ environment.name != 'production' ? 20 : -1 }"
I'm assuming it's something silly I'm doing.
b

bright-policeman-43626

02/09/2023, 4:19 PM
Hello @chilly-waitress-62592! Would you mind sharing the error? Just to confirm you are trying to make that if the environment.name is not production that evaluates to 20?
c

chilly-waitress-62592

02/09/2023, 4:37 PM
Here was the error:
Invalid template string (${environment.name != 'production'…): Unable to parse as valid template string.
The goal is to give something a value of -1 for environment.name of production and 20 otherwise.
Currently I have it working, but it looks like this now:
Copy code
variables:
  maxConcurrentRuns:
    production: -1
...
          maxConcurrentRuns: ${var.maxConcurrentRuns["${environment.name}"] || 20}
Kind of a funny mix. I believe it might have been having an issue with the negative integer?
b

bright-policeman-43626

02/09/2023, 6:49 PM
I think it did, maybe if you quote it? Definitely it was not happy with your -1, however this approach looks even better as well! ✨
23 Views