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
  • s

    stocky-spoon-28903

    06/20/2018, 5:37 PM
    E.g. If I edit the
    Name
    tag of a VPC in the AWS console, re-run my program, and then
    pulumi update
    I would expect to see the drift get corrected back to the output of my program.
    refresh
    looks like it might be the key but the workflow there is a little weird
  • i

    incalculable-sundown-82514

    06/20/2018, 5:38 PM
    Yep,
    pulumi refresh
    is the CLI verb that does this. We’ve gone back and forth about whether or not we want to do this automatically when doing an update - do you have any thoughts on that?
  • s

    stocky-spoon-28903

    06/20/2018, 5:39 PM
    IMO it would make sense from a workflow perspective
  • s

    stocky-spoon-28903

    06/20/2018, 5:39 PM
    If there is no drift, it will have no impact (other than slowing down the run), but if there is, it’s unlikely I want to create new resources based on an uncertain state of the world?
  • s

    stocky-spoon-28903

    06/20/2018, 5:42 PM
    The wording on
    refresh
    doesn’t really suggest what it will actually do in my reading either:
  • s

    stocky-spoon-28903

    06/20/2018, 5:42 PM
    Do you want to perform this refresh? details
    * pulumi:pulumi:Stack: (same)
        [urn=urn:pulumi:network::vpc-demo::pulumi:pulumi:Stack::vpc-demo-network]
      * privateSubnetIds         : [
      *     [0]: "subnet-ca80eab3"
      *     [1]: "subnet-3acb5c71"
      *     [2]: "subnet-ce024294"
        ]
      * vpcDefaultSecurityGroupId: "sg-2cb6875d"
      * vpcId                    : "vpc-31796a48"
        ~ aws:ec2/vpc:Vpc: (update)
            [id=vpc-31796a48]
            [urn=urn:pulumi:network::vpc-demo::aws:ec2/vpc:Vpc::demo-vpc]
          ~ tags                        : {
              ~ Name: "Demo Thing" => "Demo Thing XXX"
            }
    
    info: 1 change previewed:
        ~ 1 resource to update
          4 resources unchanged
  • s

    stocky-spoon-28903

    06/20/2018, 5:42 PM
    It’s not obvious there that is changing the local state against which you plan
  • i

    incalculable-sundown-82514

    06/20/2018, 5:42 PM
    ah, yeah, that’s good feedback, thank you. It isn’t obvious that it’s only updating its own state
  • i

    incalculable-sundown-82514

    06/20/2018, 5:42 PM
    I think that we’re open to automatic refresh: https://github.com/pulumi/pulumi-terraform/issues/57#issuecomment-385123611
  • s

    stocky-spoon-28903

    06/20/2018, 5:43 PM
    One thing we found was that for very large stacks, there is value in
    -refresh=false
    on
    terraform plan
  • s

    stocky-spoon-28903

    06/20/2018, 5:43 PM
    If you’re the only person hacking on something in a dev environment it’s unlikely you’ll spot drift, and it cuts down
    N
    reads to the API. I haven’t seen a rate limit problem in a while, but they used to be frequent
  • a

    adamant-restaurant-73893

    06/20/2018, 5:58 PM
    Our YouTube live stream with @white-balloon-205 will be starting in 2 minutes (supposing we can get it working... so hang in there!)

    https://www.youtube.com/watch?v=Mt7Sr4_5TBk▾

  • s

    stocky-spoon-28903

    06/20/2018, 5:59 PM
    What’s the topic?
  • a

    adamant-restaurant-73893

    06/20/2018, 6:00 PM
    He's going to walk through some general multi-cloud work, but also as we've just launched, a more general walk too.
  • s

    stocky-spoon-28903

    06/20/2018, 6:01 PM
    Sounds interesting, I’ll join…
  • s

    stocky-spoon-28903

    06/20/2018, 6:07 PM
    More of a typescript question perhaps than a pulumi one, but is this idiomatic?
  • s

    stocky-spoon-28903

    06/20/2018, 6:07 PM
    let azs = aws.getAvailabilityZones();
    const az = async function (index: number) {
        return (await azs).names[index];
    };
    
    // Access using `az(index)`
  • p

    powerful-whale-8767

    06/20/2018, 6:09 PM
    @stocky-spoon-28903 turns out we have that function for you! https://github.com/pulumi/pulumi-service/blob/e7ec13b529b2af95a4f2728ae7cf8e5cd763d2c5/infrastructure/aws.ts#L22-L25
    import * as awsinfra from "@pulumi/aws-infra";
    let az0 = await awsinfra.getAwsAz(0);
  • s

    stocky-spoon-28903

    06/20/2018, 6:11 PM
    @powerful-whale-8767 Ah excellent. Is that general pattern correct for any of the data sources though?
  • p

    powerful-whale-8767

    06/20/2018, 6:12 PM
    Yes, `await`ing the data source and then perhaps building an
    async function
    around it to massage it into more useful form seems like a pretty idiomatic approach.
  • s

    stocky-spoon-28903

    06/20/2018, 6:13 PM
    👍
  • s

    stocky-spoon-28903

    06/20/2018, 6:13 PM
    As a typescript newbie, is there a reason I can’t do
    let azs = aws.getAvailabilityZones()
    outside of a function scope?
  • m

    microscopic-florist-22719

    06/20/2018, 6:16 PM
    Nope, that should work.
  • b

    big-soccer-75859

    06/20/2018, 6:21 PM
    If you're doing
    endpoint.get('/example', routeHandlerFunc)
    does the routeHandlerFunc have an isolated scope or is pulumi smart enough to inject some outer scope?
  • b

    bitter-oil-46081

    06/20/2018, 6:23 PM
    You can close over things and if we can make it work, it will work. If we can't make it work, we'll give you an error before deploying your lambda. Note how in this example the lambda that backs the onPut event captures the cloud.Task resource and uses it at runtime: https://github.com/pulumi/examples/blob/master/cloud-js-thumbnailer/index.js#L18-L35
  • b

    big-soccer-75859

    06/20/2018, 6:24 PM
    cool
  • s

    stocky-spoon-28903

    06/20/2018, 6:25 PM
    @microscopic-florist-22719 interesting I get back:
  • s

    stocky-spoon-28903

    06/20/2018, 6:25 PM
    index.ts:10:11 - error TS1308: 'await' expression is only allowed within an async function.
    
    10 let azs = await aws.getAvailabilityZones();
                 ~~~~~
  • m

    microscopic-florist-22719

    06/20/2018, 6:25 PM
    Ahhhhhh, right
  • m

    microscopic-florist-22719

    06/20/2018, 6:26 PM
    You can't use
    await
    at the top level
Powered by Linen
Title
m

microscopic-florist-22719

06/20/2018, 6:26 PM
You can't use
await
at the top level
View count: 1