Yaml triple bracket syntax

Viewed 13

I've recently started dealing with CF templates in my org what uses the following syntax.

metadata:
   name: {{{MY_APP}}}-resources
Resources:
  DBInstance:
    Properties:
      DBName: "{{{DB_NAME}}}_db_{{{NAMESPACE}}}"
      EngineVersion: "{{{DB_ENGINE_VERSION}}}"
      ...

The variables are passed via a delivery.yaml . And the intention and operation works. I find the syntax confusing though and couldn't find a reference on the yaml spec.

VSCode RedHat's yaml extension complains about this line (and many other similar ones across the files):

name: {{{MY_APP}}}-resources

with the message:

Unexpected scalar at node end

My understanding so far after looking online is that the complain is due to the - symbol. It can cause ambiguity since if these values would come as numbers it could be missinterpreted as an operation. Several alternatives seems to satisfy the linter:

  • '{{{MY_APP}}}-resources'
  • ${MY_APP}-resources
  • etc, etc

So a couple of questions:

  • what's up with the triple brackets? is that just for visuals or does it do sth different than single brackets.
  • What's the recommended way to do this given the AWS CF context?
0 Answers
Related