Support the exported value of a stack being a Promise/Output itself (#2916)

This commit is contained in:
CyrusNajmabadi 2019-07-09 17:22:35 -07:00 committed by GitHub
parent 4dd4943ef3
commit 73b4100899
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 10 deletions

View file

@ -8,9 +8,10 @@ CHANGELOG
[#2784](https://github.com/pulumi/pulumi/issues/2784))
- Fix an issue where output values of a resource would not be present when they
contained secret values, when using Python.
- Fix an issue where emojis are printed in non-interactive mode. (fixes
[#2871](https://github.com/pulumi/pulumi/issues/2871))
- Promises/Outputs can now be directly exported as the top-level (i.e. not-named) output of a Stack.
(fixes [#2910](https://github.com/pulumi/pulumi/issues/2910))
## 0.17.21 (2019-06-26)

View file

@ -74,21 +74,13 @@ class Stack extends ComponentResource {
// helps ensure that outputs can point to resources, and that that is stored and
// presented as something reasonable, and not as just an id/urn in the case of
// Resources.
super.registerOutputs(outputs === undefined ? undefined : massageOutputs(outputs));
super.registerOutputs(massage(outputs, new Set()));
}
return outputs;
}
}
function massageOutputs(outputs: Inputs): Inputs {
const result: Inputs = {};
for (const k of Object.keys(outputs)) {
result[k] = output(outputs[k]).apply(v => massage(v, new Set()));
}
return result;
}
async function massage(prop: any, seenObjects: Set<any>): Promise<any> {
if (prop === undefined ||
prop === null ||