https://pulumi.com logo
Docs
Join the conversationJoin Slack
Channels
announcements
automation-api
aws
azure
blog-posts
built-with-pulumi
cloudengineering
cloudengineering-support
content-share
contribex
contribute
docs
dotnet
finops
general
getting-started
gitlab
golang
google-cloud
hackathon-03-19-2020
hacktoberfest
install
java
jobs
kubernetes
learn-pulumi-events
linen
localstack
multi-language-hackathon
office-hours
oracle-cloud-infrastructure
plugin-framework
pulumi-cdk
pulumi-crosscode
pulumi-deployments
pulumi-kubernetes-operator
pulumi-service
pulumiverse
python
registry
status
testingtesting123
testingtesting321
typescript
welcome
workshops
yaml
Powered by Linen
general
  • b

    boundless-monkey-50243

    08/31/2018, 7:02 PM
    @bitter-oil-46081 Correct. It results in an export of
    { vpc: "vpc-xxx" }
    , which is inconsistent with uses of
    vpc
    in the code itself. (Having to remember that this
    vpc
    is a string is weird.)
  • b

    boundless-monkey-50243

    08/31/2018, 7:03 PM
    My natural assumption would be more like
    { vpc: { id: "vpc-xxx" } }
    , to match the pattern of accessing the object that I gave Pulumi to deal with.
  • b

    boundless-monkey-50243

    08/31/2018, 7:06 PM
    (I realize this is a breaking change, but I find the cognitive load of having to remember things my typechecker can't to be frustrating.)
  • s

    stocky-spoon-28903

    08/31/2018, 7:06 PM
    I had not noticed this in prior use - I guess I hadn’t tried exporting a whole resource
  • b

    boundless-monkey-50243

    08/31/2018, 7:07 PM
    I just assumed it would be allowed, yeah.
  • b

    bitter-oil-46081

    08/31/2018, 7:10 PM
    Opened: https://github.com/pulumi/pulumi/issues/1858 just so we don't lose track here.
  • a

    adventurous-jordan-10043

    08/31/2018, 8:09 PM
    is there any plan for providing a way of exporting a
    pulumi preview
    in a file for a later use with
    pulumi update
    ?
  • a

    adventurous-jordan-10043

    08/31/2018, 8:10 PM
    something like
    tf plan -out x
    and then
    tf apply x
    b
    • 2
    • 5
  • b

    boundless-monkey-50243

    09/02/2018, 3:14 PM
    JS/TS: Because I need to use stuff like
    aws.getAvailabilityZones
    inline, I've tried to wrap my Pulumi definition into a Promise. This results in getting no outputs, either when assigning it directly to
    module.exports
    or
    export
    -ing values as keys. How do I correctly do this so Pulumi picks up what I am putting down?
  • b

    boundless-monkey-50243

    09/02/2018, 3:21 PM
    Realistically I would probably want to just wrap everything in
    module.exports = (async () => doSomething())();
    in order to avoid thinking about the lack of top-level await
  • b

    boundless-monkey-50243

    09/02/2018, 3:23 PM
    As-is I'm kind of stuck because I don't know how to get my outputs out of the program 😐
  • b

    big-piano-35669

    09/02/2018, 3:26 PM
    The lack of top-level await is definitely unfortunate for cases like this. We've been discussing ways to make this easier -- https://github.com/pulumi/pulumi/issues/1611 lists a few approaches that work today, plus some ideas on how we might make it better. Hopefully one of the workarounds unsticks you and any feedback on that issue is appreciated.
  • b

    boundless-monkey-50243

    09/02/2018, 3:29 PM
    Maybe I suddenly can't read, but I don't see any workarounds outlined there? I see ideas, but no workarounds
  • b

    big-piano-35669

    09/02/2018, 3:30 PM
    That first code snippet will work. You can export a promise as an output and it will be recorded by Pulumi as a stack output.
  • b

    boundless-monkey-50243

    09/02/2018, 3:31 PM
    I tried that.
  • b

    boundless-monkey-50243

    09/02/2018, 3:31 PM
    Oh, wait, no. I tried to unwrap it myself.
  • b

    boundless-monkey-50243

    09/02/2018, 3:32 PM
    hm. That's really unfortunate
  • b

    boundless-monkey-50243

    09/02/2018, 3:32 PM
    I can deal with it, though
  • b

    big-piano-35669

    09/02/2018, 3:33 PM
    Can you share the code you tried? There are discussions in TS/ES land about top level await, but I don't know if they'll ever happen, because of the impact to module loading. And if they did, I worry they'd be done in a way that doesn't address this problem (since you'd want to export after the first await has occurred).
  • b

    big-piano-35669

    09/02/2018, 3:34 PM
    But in general, I think there are some simple things we can do here so that the code you try first will just work, like exporting whole objects.
  • b

    boundless-monkey-50243

    09/02/2018, 3:34 PM
    Top-level await is bad, yeah
  • b

    boundless-monkey-50243

    09/02/2018, 3:34 PM
    All I did was this
  • b

    boundless-monkey-50243

    09/02/2018, 3:34 PM
    module.exports = (async () => {
      return { x: 5 };
    })();
  • b

    boundless-monkey-50243

    09/02/2018, 3:35 PM
    IMO (and I'm responding to that issue) it's pretty natural to expect a function that's returned to be evaluated, or a Promise to be unwrapped
  • b

    big-piano-35669

    09/02/2018, 3:35 PM
    We should absolutely just make that work. Let me look a little into this today, and sorry for the hassles!
  • b

    boundless-monkey-50243

    09/02/2018, 3:35 PM
    No problem - I get the difficulty, Promise juggling sucks
    👍 1
  • b

    big-piano-35669

    09/02/2018, 3:41 PM
    Btw, I believe this will work for your example
    module.exports.x = (async () => {
      return { x: 5 };
    })().then(o => o.x);
    Not ideal, but it should do the trick.
  • b

    boundless-monkey-50243

    09/02/2018, 3:41 PM
    Oh, will it? Awesome
  • b

    boundless-monkey-50243

    09/02/2018, 3:42 PM
    Well, sort of. I have a bunch of stuff coming out of the same function
  • b

    boundless-monkey-50243

    09/02/2018, 3:42 PM
    So it'd be effectively the same as the top comment
Powered by Linen
Title
b

boundless-monkey-50243

09/02/2018, 3:42 PM
So it'd be effectively the same as the top comment
View count: 2