Invalid template string
# 🌱|help-and-getting-started
c
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
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
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
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! ✨
30 Views