0

I've created an Output for environment variables in Pulumi just like https://github.com/pulumi/examples/blob/master/aws-ts-airflow/index.ts#L61 but I need to add one entry to these env vars for one of the containers I'm spinning up.

I'd like to do something like when declaring a container similar to https://github.com/pulumi/examples/blob/master/aws-ts-airflow/index.ts#L79-L85

            "webserver": {
                image: awsx.ecs.Image.fromPath("webserver", "./airflow-container"),
                portMappings: [airflowControllerListener],
                environment: environment + {name: "ANOTHER_ENV", value: "value"},
                command: [ "webserver" ],
                memory: 128,
            },

I've tried playing around with pulumi.all (pulumi.all([environment, {name: "FLASK_APP", value: "server/__init.py"}])) and environment.apply but haven't been able to figure out how to contact to an Output.

Is this possible? If so, how?

Paymahn Moghadasian
  • 9,301
  • 13
  • 56
  • 94

1 Answers1

2

You should be able to

const newEnvironment = environment.apply(env =>
    env.concat({ name: "ANOTHER_ENV", value: "value"}));

// ...

"webserver": {
    image: awsx.ecs.Image.fromPath("webserver", "./airflow-container"),
    portMappings: [airflowControllerListener],
    environment: newEnvironment,
    command: [ "webserver" ],
    memory: 128,
},
Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107