This can be useful for running a custom build command to generate assets which will be used as part of your Pulumi deployment.
Run a command, specifying ENV variables based on the output of another resource.
const clientBuild = new Exec('demo-client-build', {
command: 'cd ../client && yarn build',
options: {
env: pulumi
.all([userPool.id, authClient.id])
.apply(([cognitoUserPoolId, userPoolWebClientId]) =>
Object.assign(
{
REACT_APP_USER_POOL_ID: cognitoUserPoolId,
REACT_APP_USER_POOL_WEB_CLIENT_ID: userPoolWebClientId,
},
process.env,
),
),
},
});
This resource can then be explicitly depended on to ensure it completes before subsequent steps.