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
typescript
  • f

    future-air-70511

    11/10/2020, 5:42 PM
    Has anyone received this error before?
    error: open \\.\pipe\pulumi1078871896\invoke_req: The system cannot find the path specified.
    • 1
    • 2
  • c

    colossal-australia-65039

    11/11/2020, 9:45 PM
    I'm getting a type error with this code
    import * as aws from "@pulumi/aws"
    import * as awsx from "@pulumi/awsx"
    
    const vpc = aws.ec2.Vpc.get('vpc_name', 'vpc-39485703984509')
    const listener = new awsx.lb.NetworkListener("nginx", { vpc, port: 80 })
    index.ts(18,57): error TS2740: Type 'Vpc' is missing the following properties from type 'Vpc': vpc, initialize, addInternetGateway, addNatGateway, and 12 more.
    how can i reference an already-existing resource and use it with crosswalk?
    l
    • 2
    • 4
  • s

    steep-angle-29984

    11/12/2020, 9:44 AM
    How to display logs which where output using
    pulumi.log.debug()
    ?
    g
    • 2
    • 2
  • r

    red-area-47037

    11/12/2020, 5:42 PM
    Hi all, I am fighting with the right format to pass in a config setting for a Helm Chart I am deploying using Pulumi and I hope someone can help me out. We use Pulumi to bootstrap all core components which includes ArgoCD which will then deploy services developed by our teams. ArgoCD allows the configuration of private Gitrepos via Helm Values. You can find an example of the expected syntax here: https://github.com/argoproj/argo-helm/blob/1f67a85a587182a5f741cb3f846eeb6f2ec887ce/charts/argo-cd/values.yaml#L528
    repositories: |
          - url: git@github.com:group/repo.git
            sshPrivateKeySecret:
              name: secret-name
              key: sshPrivateKey
    In Pulumi I use the following code to deploy the ArgoCD chart and try to pass in the relevant configuration for the repositories as part of the values. The values are defined in Javascript Object notation and I don't know how I can define the configration in the expected literal YAML block scalar format...
    const argocdChart = new k8s.helm.v3.Chart(
      'argocd',
      {
        chart: 'argo-cd',
        namespace: 'argocd',
        version: '2.9.3',
        fetchOpts: {
          repo: '<https://argoproj.github.io/argo-helm>'
        },
        values: {
          configs: {
            secret: {
              argocdServerAdminPassword: config.argocd.passwordHash
            }
          },
          server: {
            config: {
              'application.instanceLabelKey': '<http://argocd.argoproj.io/instance|argocd.argoproj.io/instance>', 
              repositories: `
                - url: "<https://github.com/mycorp/myprivaterepo>"
                  passwordSecret:
                    name: "${argocdGitHubTokenSecretName}", 
                    key: "password"
                  usernameSecret:
                    name: "${argocdGitHubTokenSecretName}", 
                    key: "username"`,
                }
          }
        }
      },
      {
        provider: cluster.provider,
        dependsOn: [certmanager]
      }
    )
    I tried different solutions (e.g. Raw string
    as you see above or just using js object notation), but somehow nothing so far worked and I am stuck right now 😞 I know this is basically more a Typescript / Javascript question, but I hope someone of you has the right tip. Thanks, Andreas
    b
    • 2
    • 3
  • w

    wet-soccer-72485

    11/14/2020, 6:50 PM
    https://pulumi-community.slack.com/archives/CRFURDVQB/p1605379833276900
  • k

    kind-addition-90773

    11/15/2020, 1:25 AM
    for (let i = 0; i < pulumi.output(subnets).apply(x => x.length); i++ ) {
    // do something with subnets[i]
    }
    d
    • 2
    • 3
  • k

    kind-addition-90773

    11/15/2020, 1:27 AM
    Hi everyone, I'm trying to loop over an array of aws subnets as shown above, but I am tripping over
    Operator '<' cannot be applied to types 'number' and 'OutputInstance<number>'.ts(2365)
  • k

    kind-addition-90773

    11/15/2020, 1:29 AM
    Any help would be appreciated
  • d

    dazzling-sundown-39670

    11/15/2020, 3:59 AM
    How can I get previous state in
    pulumi.dynamic.Resource
    constructor before running super?
    • 1
    • 1
  • l

    little-cartoon-10569

    11/16/2020, 2:18 AM
    Has anyone seen this error before? I've just upgraded to latest Pulumi CLI and libraries, I'm guessing it's related?
    Unable to deserialize resource urn😛ulumi:stack:😛roject:myproj:aws:MyComponent$aws:iam/role:Role::MyComponent, no module is registered for iam/role.
    c
    • 2
    • 8
  • l

    limited-postman-77982

    11/17/2020, 2:18 AM
    Hi all. I am working on deploying an eks stack on aws and getting the following error:
    error: failed to load language plugin node.js: no language plugin 'node.js' found in the workspace or on your $PATH
    I've verified that I have nvm installed correctly and I've just set my .nvm in the dir that I'm working in for node lts ...
    $ node -v
    v14.15.1
    This is from that directory.
    /.nvm/versions/node/v14.15.1/bin:
    I'm omitting my User/name/ but this is in my $PATH ... I'm sure I'm missing something simple, but thought I'd reach out. As a note, I have successfully launch numerous aks and other resources on Azure without issue using TS. But this is a new directory and update node.js version, etc. Any help would be very appreciated! Thanks!
    l
    • 2
    • 3
  • l

    limited-postman-77982

    11/17/2020, 2:19 AM
    Also to note, I went back and did an npm install in the dir after setting my .nvm and sourcing my PATH, which did not resolve the issue.
  • l

    limited-postman-77982

    11/17/2020, 2:26 AM
    Added debugging note:
    $ pulumi plugin install
    error: failed to load language plugin node.js: no language plugin 'node.js' found in the workspace or on your $PATH
    l
    • 2
    • 36
  • q

    quiet-wolf-18467

    11/17/2020, 2:26 PM
    Does anyone know how to mock a Kubernetes provider for tests? 😄
  • q

    quiet-wolf-18467

    11/17/2020, 3:58 PM
    Would it be possible for someone from Pulumi to provide an example of testing
    kubernetes.yaml.ConfigFile
    and making assertions against the specs? I’m really struggling and would appreciate an assist 🙂
  • q

    quiet-wolf-18467

    11/17/2020, 3:59 PM
    Here’s where I’ve gotten to: https://gist.github.com/rawkode/12bf391cb58ab2ccdcfe968a9d2e83ad
  • q

    quiet-wolf-18467

    11/17/2020, 4:00 PM
    and I’m trying to test these transformations: https://gitlab.com/pulumi-packs/kubernetes/cluster-api/-/blob/main/src/index.ts
    b
    g
    • 3
    • 12
  • r

    rhythmic-flag-11093

    11/18/2020, 7:39 PM
    @here Got this error when I added some code to deploy EC2 instances in my stack. Not the greatest TypeScript person so any help would be great 😞
    Diagnostics:
      pulumi:pulumi:Stack (aws-xxx-local-abdul):
        The Pulumi runtime detected that 97 promises were still active
        at the time that the process exited. There are a few ways that this can occur:
          * Not using `await` or `.then` on a Promise returned from a Pulumi API
          * Introducing a cyclic dependency between two Pulumi Resources
          * A bug in the Pulumi Runtime
        Leaving promises active is probably not what you want. If you are unsure about
        why you are seeing this message, re-run your program with the `PULUMI_DEBUG_PROMISE_LEAKS`
        environment variable. The Pulumi runtime will then print out additional
        debug information about the leaked promises.
    I reverted all the changes but the error still persists. Any idea how to "reset"? The code I used was also commented saying it resolved promises lol ¯¯\_( ͡° ͜ʖ ͡°)_/¯
    b
    h
    • 3
    • 2
  • b

    busy-soccer-65968

    11/24/2020, 8:53 PM
    i'm noticing
    Docker.Image
    building during preview. is this typical?
    l
    • 2
    • 4
  • s

    salmon-honey-75627

    11/24/2020, 10:46 PM
    I’m trying to break my pulumi definition into multiple files. I’m not too familiar with typescript so that might be causing my problems. Right now, if I want to export a helper function for use by another file, that gets picked up as a stack output. What’s the best way to deal with this? I obviously don’t want a bunch of random javascript objects and type interfaces getting exported as stack outputs but I also can’t shove everything in a single file.
    b
    l
    h
    • 4
    • 13
  • l

    little-cartoon-10569

    11/25/2020, 10:25 PM
    Is it possible to compare output values in Mocha+ChaiAsPromised tests? I use assertions like
    return expect(bucketObject.name.promise()).to.eventually.eql("Joanne.txt");
    Is there a way to do something more like this?
    return user.name.promise().then(username => expect(bucketObject.name.promise()).to.eventually.eql(`${username}.txt`));
    • 1
    • 2
  • a

    adamant-translator-31969

    12/02/2020, 1:11 PM
    Hi! how Can I use existing stack in new proyect? I want to do this from ts code
    b
    k
    • 3
    • 10
  • d

    dazzling-sundown-39670

    12/02/2020, 2:08 PM
    Why does going from
    new k8s.core.v1.Namespace(namespaceName)
    to
    new k8s.core.v1.Namespace(namespaceName, {}, { provider: k8sProvider });
    recreate the namespace? Is there some way I can avoid recreating it? I really need to put provider there but I don't want to update every single resource in my cluster
    • 1
    • 3
  • b

    breezy-cricket-40277

    12/03/2020, 9:54 AM
    Hi guys. I generate a password with
    @pulumi/random
    and then I have my own method to generate an hash out of it, then
    base64
    encode to put in a k8s secret. My question is, how can I make sure that my
    hash
    method is only called if the
    RandomPassword
    changes?
    b
    b
    w
    • 4
    • 9
  • s

    sparse-soccer-23105

    12/07/2020, 2:26 PM
    Hi guys, I would like to retrieve some properties from an aws.Provider(), such as the AccessKey or the SecretKey, in order to inject them to my shell environment. The reason is I'm running some EKS stack in different account from several automation role and I need to have the right "automation-role' credentials injected into my environment in order to reach the K8s API in those different accounts I am creating the aws.Provider() as so :
    new aws.Provider(
          `${account}-assume-role-${region}`,
          {
            assumeRole: {
              roleArn: `arn:aws:iam::${acc.Id}:role/automation-role`,
              sessionName: "xxxx",
              externalId: "xxxx"
            },
            region
          },
          { version: "2.13.1" }
        );
    b
    • 2
    • 1
  • g

    gifted-terabyte-92288

    12/08/2020, 3:51 PM
    👋 Hey guys, I had a question about module dependency patterns. I noticed that many of the examples have lambda or application code in the same file as the Pulumi setup. A lot of times, there's quite a bit of code and other stuff going on so separating it into folders makes sense. However, doing that I ran into this scenario:
    // file 1 - pulumi.ts
    import lambdaFn from './lambda.ts';
    const bucket = new aws.s3.Bucket('blake-lambda-bucket');
    const endpoint = new awsx.apigateway.API('create', {
      routes: [
        {
          path: '/',
          method: 'POST',
          eventHandler: lambdaFn
        }
      ]
    });
    
    export const lambdaUrl = endpoint.url;
    export const bucketId = bucket.id
    
    // file 2 - lambda.ts
    import { bucketId } from './pulumi.ts';
    
    async function putStuffInBucket() {
      // do things
    }
    
    export default putStuffInBucket
    File 1 depends on the lambda code in file 2. File 2 depends on file 1 for the bucket name. That seems like a circular dependency, no? I've seen some examples where a string relative path is used to point to a file -- is that the preferred pattern? Can that point to a directory? I've also seen environment variables being set for some lambdas from the Pulumi file and those being consumed via lambda code. Just looking for some guidance on best practices / preferred patterns - thanks!
    b
    f
    • 3
    • 13
  • l

    little-cartoon-10569

    12/08/2020, 10:33 PM
    When I change my dependencies from pulumi-aws 3.17.0 to 3.18.0 (no other changes), I get two errors when running my tests. First:
    error TS2339: Property 'promise' does not exist on type 'Output<string>'.
    
    66           resource.arn.promise()
    My test file includes this:
    declare module '@pulumi/pulumi' {
      export interface OutputInstance<T> {
        promise(withUnknowns?: boolean): Promise<T>;
      }
    }
    This has worked until 3.17.0, and in theory has nothing to do with pulumi-aws...
  • l

    little-cartoon-10569

    12/08/2020, 10:34 PM
    The second error is
    error TS7053: Element implicitly has an 'any' type because expression of type '0' can't be used to index type 'Output<string[] | undefined>'.
      Property '0' does not exist on type 'Output<string[] | undefined>'.
    
               resource.propertyOfTypeOutputStringArray[0].promise(),
    • 1
    • 3
  • l

    little-cartoon-10569

    12/11/2020, 1:24 AM
    What is the recommended way to import types?
    c
    • 2
    • 6
  • c

    colossal-easter-73659

    12/11/2020, 2:53 PM
    hello all, i am trying to deploy an api to region A, and hook into a lambda in region B. my issue is that I either use ‘providers’ param, and it deploys to us-west-2 every time, or I use ‘provider’ param and says it isnt allowed across regions. this is what I think will work, but I’m guessing I need some way to make pulumi know that I need the permission resource generated to be region specific. this is possible on the console with a few simple clicks in integrations request screen. it simply allows me to select a different region. and when clicking apply it applies the trigger to the lambda correctly.
Powered by Linen
Title
c

colossal-easter-73659

12/11/2020, 2:53 PM
hello all, i am trying to deploy an api to region A, and hook into a lambda in region B. my issue is that I either use ‘providers’ param, and it deploys to us-west-2 every time, or I use ‘provider’ param and says it isnt allowed across regions. this is what I think will work, but I’m guessing I need some way to make pulumi know that I need the permission resource generated to be region specific. this is possible on the console with a few simple clicks in integrations request screen. it simply allows me to select a different region. and when clicking apply it applies the trigger to the lambda correctly.
View count: 1