best-lifeguard-91445
02/04/2021, 8:19 PMexport const evaluateEnvironmentVariables = (services: Services, variables: Map<string, Output<string>>): void => {
for (const service of services) {
for (const envVar of service.environment) {
const envVarName = envVar.name.toString();
const replacementValue = variables.get(envVarName);
if (replacementValue) {
replacementValue.apply(value => {
envVar.value = value; // envVar.value is Input<string>, value is Output<string>
});
}
}
}
};
services.evaluateEnvironmentVariables(allServices, variables);
// Create resource that depends on these updated environment variables (KeyValuePair)
little-cartoon-10569
02/04/2021, 8:23 PMnew YourEnvVarResource(name, {
services: pulumi.output(services).apply((services) => { /* your code */}),
...
});
apply
, I think? So it wouldn't be created until that apply completed...best-lifeguard-91445
02/04/2021, 8:30 PM