pulumi / esc

Pulumi ESC (Environments, Secrets, and Configuration) for cloud applications and infrastructure.
https://www.pulumi.com/product/esc/
Apache License 2.0
216 stars 7 forks source link

Add option to interpolate subcommand variables without a manual sub-shell #299

Open lblackstone opened 4 months ago

lblackstone commented 4 months ago

Hello!

Issue details

Using esc run often requires an explicit sub-shell to execute the desired command. Here's an example:

Environment definition:

values:
    environmentVariables:
        ESC_ORG: You are in the ${context.pulumi.organization.login} organization!
        ESC_HELLO_USER: Hello, ${context.pulumi.user.login}!
    files:
        DOCKER_ENVFILE: |
            ESC_ORG=${environmentVariables.ESC_ORG}
            ESC_HELLO_USER=${environmentVariables.ESC_HELLO_USER}

ESC command

esc run -i <your-environment-name> -- sh -c 'docker run --rm -t --env-file=$DOCKER_ENVFILE alpine env'

It would be nicer if we could write the command like this instead (notice the lack of sh -c ''):

esc run -i <your-environment-name> -- docker run --rm -t --env-file=\$DOCKER_ENVFILE alpine env

Affected area/feature

esc run