https://pulumi.com logo
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
  • c

    creamy-potato-29402

    09/24/2018, 4:55 PM
    Also… just to make sure I’m not missing something on the first error, you are saying that this message is confusing because you have run
    npm install
    , right?
    f
    • 2
    • 11
  • f

    full-dress-10026

    09/24/2018, 5:00 PM
    For those of us on terminals with dark backgrounds, the message here is really hard to read.
    i
    • 2
    • 7
  • w

    wooden-air-15246

    09/24/2018, 5:00 PM
    sure, why not?
  • f

    full-dress-10026

    09/24/2018, 5:56 PM
    Does Pulumi use Terraform?
    c
    b
    • 3
    • 7
  • e

    eager-area-86739

    09/24/2018, 6:25 PM
    I would like to pick the community brains: I'm building a Serverless app. One of the methods is a post, with some logic, and stores in DynamoDB. The Lambda is build with C#. Using pulumi, there are several aways to Deploy it,
    aws-serverless
    ,
    cloud-aws
    and
    aws
    packages. Given that we want to use X-Ray and Cognitive, what is the best approach?
  • f

    full-dress-10026

    09/24/2018, 7:16 PM
    If I have some code written in
    my-service.ts
    , is there a way to conditionally provision those resources based on a value in the config?
    h
    • 2
    • 12
  • i

    incalculable-sundown-82514

    09/24/2018, 7:54 PM
    Hey all - I’m in the process of designing a feature that will allow for client-side encryption of secrets within a Pulumi stack’s state file, which is managed by the service. If you’re interested in client-side encryption of secrets, I’d really appreciate it if you checked it out and left comments, especially comments about whether or not the proposed scheme is sufficient for you and/or if you are happy with it: https://github.com/pulumi/pulumi/issues/1867#issuecomment-424102794
  • f

    full-dress-10026

    09/24/2018, 8:23 PM
    Is there a way to get the CloudFormation outputs from
    aws.cloudformation.Stack
    ?
  • f

    full-dress-10026

    09/24/2018, 9:08 PM
    I didn't see any way to get the outputs from the
    Stack
    object so I tried this:
    let myStack = new aws.cloudformation.Stack("my-stack", {
        templateUrl: templateUrl,
        capabilities: ["CAPABILITY_NAMED_IAM"]
    });
    
    let myStackName = myStack.name;
    
    let r = shell.execSync(`aws cloudformation describe-stacks --stack-name ${myStackName}`);
    console.log("out:", r);
    Intuitively that would work, but it's now clear there are multiple stages in processing an update. Presumably
    .name.get()
    is available at a later stage.
  • s

    stocky-spoon-28903

    09/24/2018, 9:10 PM
    @full-dress-10026 Since it’s based on the Terraform provider,
    outputs
    should be a field available on a Stack resource unless something unusual has happened to that one
  • s

    stocky-spoon-28903

    09/24/2018, 9:11 PM
    https://github.com/pulumi/pulumi-aws/blob/master/sdk/nodejs/cloudformation/stack.ts#L55 suggests it should be there!
  • f

    full-dress-10026

    09/24/2018, 9:14 PM
    I see that there. Not sure I understand how I'm supposed to use it. I'd only like to get a value from the outputs, not transform it.
  • s

    stocky-spoon-28903

    09/24/2018, 9:15 PM
    Ah I see! You can likely do this:
  • s

    stocky-spoon-28903

    09/24/2018, 9:15 PM
    let particularOutput = myStack.outputs.apply(o => o.particularOutput);
  • s

    stocky-spoon-28903

    09/24/2018, 9:16 PM
    The part in the lambda might need to be indexed rather than called using the object syntax (I’m on my phone and can’t test it easily right now)
  • f

    full-dress-10026

    09/24/2018, 9:18 PM
    Perhaps a console.log is not executing at the right stage. I have this:
    let myStackName = myStack.outputs.apply(o => o["VpcId"]);
    console.log("out:", myStackName);
    which prints this in Diagnostics after running `pulumi update`:
    pulumi:pulumi:Stack: infrastructure-infra-dev
        info: out: Output {
          __pulumiOutput: true,
          isKnown: Promise { <pending> },
          resources: [Function],
          promise: [Function],
          apply: [Function],
          get: [Function] }
  • s

    stocky-spoon-28903

    09/24/2018, 9:21 PM
    If you move the console log inside the apply, does that do what you expect?
  • f

    full-dress-10026

    09/24/2018, 9:23 PM
    Ah yes! Do you know if there are any docs that describe these stages? It seems valuable to understand the lifecycle here.
  • s

    stocky-spoon-28903

    09/24/2018, 9:23 PM
    I’m sure there are some, I’ll have to look for exactly where though - someone else might beat me to that
  • w

    white-balloon-205

    09/24/2018, 9:24 PM
    There are some very light docs here - definitely could use expanding on: https://pulumi.io/reference/programming-model.html#outputs
  • f

    full-dress-10026

    09/24/2018, 9:26 PM
    Right, I saw that. I'd suggest adding that outputs are only available after having run an update, not in the global scope.
    👍 1
  • f

    full-dress-10026

    09/24/2018, 9:28 PM
    I'm also curious if writing some bash commands to be executed after the "resolve outputs" stage is possible. If so, is there a suggested way to do so? It feels wrong to write an IO call in the
    .apply
    function.
  • f

    full-dress-10026

    09/24/2018, 9:30 PM
    Kinda like what I did here:
    let myStack = new aws.cloudformation.Stack("my-stack", {
        templateUrl: templateUrl,
        capabilities: ["CAPABILITY_NAMED_IAM"]
    });
    
    let myStackName = myStack.name;
    
    let r = shell.execSync(`aws cloudformation describe-stacks --stack-name ${myStackName}`);
    console.log("out:", r);
  • f

    full-dress-10026

    09/24/2018, 10:22 PM
    Is there a way to get the vpc id created from a
    cloud.Service
    ? I see
    .ecsService.networkConfiguration
    contains
    subnets
    but not
    vpc
    .
  • f

    full-dress-10026

    09/24/2018, 10:43 PM
    If
    subnets
    was a list of `aws.ec2.Subnet`s then you'd be able to get the vpc id.
  • p

    proud-tiger-5743

    09/24/2018, 10:53 PM
    If I'm creating two pieces of infrastructure - but one needs the
    name
    of the previous one, how can I ensure that infrastructure A exists before Infrastructure B is created?
    f
    s
    • 3
    • 15
  • p

    proud-tiger-5743

    09/24/2018, 10:56 PM
    Example - I'm mapping an API Gateway to Kinesis - but the API gets created before, and so it can't access the
    name
    of the Kinesis stream
  • f

    full-dress-10026

    09/24/2018, 10:57 PM
    I was able to get the VPC id by doing this:
    let serviceSubnets = service.ecsService.networkConfiguration.apply(o => {
        if (o != null) {
            return o["subnets"];
        } else {
            throw new Error("No network configuration present on service. Cannot proceed.");
        }
    });
    let serviceFirstSubnet = serviceSubnets.apply(subnets => subnets[0]);
    let serviceVpcId = aws.ec2.Subnet.get("subnet", serviceFirstSubnet).vpcId;
    There must be a cleaner way to do this.
  • w

    white-balloon-205

    09/25/2018, 12:44 AM
    I'm a little surprised you need to test for
    null
    in that code - the callback should only run when the
    networkConfiguration
    is available. Were you seeing otherwise?
    f
    • 2
    • 4
  • w

    white-balloon-205

    09/25/2018, 12:48 AM
    Another alternative that should work for the above would be something along the lines of:
    let serviceVpcId = service.ecsService.networkConfiguration.apply(async (networkConfig) => {
        let subnetId = networkConfig["subnets"][0];
        let subnet = await aws.ec2.getSubnet({ id: subnetId });
        return subnet.vpcId;
    });
Powered by Linen
Title
w

white-balloon-205

09/25/2018, 12:48 AM
Another alternative that should work for the above would be something along the lines of:
let serviceVpcId = service.ecsService.networkConfiguration.apply(async (networkConfig) => {
    let subnetId = networkConfig["subnets"][0];
    let subnet = await aws.ec2.getSubnet({ id: subnetId });
    return subnet.vpcId;
});
View count: 1