jinja2-cli how to get env variable into the template

260 Views Asked by At

I have a jinja template defined as deployment.yml.j2 with

environments:
  default:
    databricks_host: data
    jobs:
      - test: "{% lookup('env', 'ENVIRONMENT_TYPE') %}"

The variable file does not matter, it can be an empty file. When parsing the template and file with jinja2 --format=yml deployment.yml.j2 conf_staging.yml I get jinja2.exceptions.UndefinedError: 'lookup' is undefined I also tried to get the system env vars with env['ENVIRONMENT_TYPE']. In python, this works but from the CLI, I get that env is undefined. Any help on what I am doing wrong?

0

There are 0 best solutions below