How to share a set of environment variables between applications in their manifest.yml file.
search cancel

How to share a set of environment variables between applications in their manifest.yml file.

book

Article ID: 427048

calendar_today

Updated On:

Products

VMware Tanzu Platform Core VMware Tanzu Application Service

Issue/Introduction

When deploying applications on TPCF, you may wish to share a subset of common environment variables between multiple apps. This article will describe how to do so, with an example.

Environment

TPCF

Resolution

This can be achieved using application variables in the manifest. More details on this can be found here:

https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html#variable-substitution

Another option is to use the "<<" YAML format. For example, in your manifest.yml:

test-example: &test-example
  Example1: "Development"
  Example2: "true"
  Example3: "true"

second-example: &second-example
  Example4: "Foo"
  Example5: "bar"
  Example6: "three"


applications:
- name: example-app
  env:
    <<: *test-defaults
    <<: *more-defaults
    ...

This will pass in both sets of env variables to the example-app, as well as any other apps defined below it in the manifest.yml