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

    curved-pharmacist-41509

    09/06/2021, 7:55 AM
    We just tried to upgrade one of our projects to TypeScript 4.4 to get access to the aliased type narrowing and we can’t due to the
    useUnknownInCatchVariables
    option not existing in 3.7. We also can’t just alias our errors as any for now because TypeScript 3.7 errors with
    Catch clause variable cannot have a type annotation.
    Any plans to upgrade typescript, or just use the version installed in the project
    g
    • 2
    • 5
  • b

    bland-byte-34481

    09/07/2021, 4:36 PM
    Please let me know if this is not an appropriate question for this audience (apologies if so and happy to remove if it is), but are there any folks here that are doing consulting / work at consulting shops that have experience with Typescript / Pulumi / AWS?
    b
    • 2
    • 2
  • l

    lively-crowd-44886

    09/07/2021, 11:38 PM
    Hey all! Anyone know if there’s a way to refresh the provider state for typescript custom providers?
    l
    • 2
    • 10
  • t

    thousands-area-40147

    09/09/2021, 9:06 AM
    Hej everyone! I'm having trouble finding answers to this question, but maybe someone can point me in the right direction here. What are best practices to modify a resource during runtime, specifically when the modification depends on a conditional? Let's say we need to provision
    Resource A
    no matter what, but
    Resource B
    might be omitted for a stack. If
    Resource B
    is provisioned however, it will depend on
    Resource A
    , but also changes will need to happen to
    Resource A
    after creating
    Resource B
    . As far as I can tell, there's no
    modify
    method or similar for resources that have already been created, or am I missing something?
    l
    l
    p
    • 4
    • 4
  • p

    proud-pizza-80589

    09/14/2021, 9:24 AM
    Anyone ever got the following
    Error [ERR_REQUIRE_ESM]: require() of ES Module <…>/node_modules/node-fetch/src/index.js from <…>/node_modules/@pulumi/azure/eventgrid/zMixins.js not supported.
    Latest node 16, worked a while ago
    • 1
    • 3
  • f

    fresh-honey-15888

    09/14/2021, 4:42 PM
    Is there a recommended solution for templating? I'm submitting jobs to Nomad and want to embed secrets in the jobspecs. I thought I could do something like: `const drone = new nomad.Job("lightsoutgames-drone", { jobspec: eval("`" + readFileSync("lightsoutgames-drone.nomad").toString() + "`") })`` then I can treat the jobspec like a template string and embed secrets in it. The
    eval
    trick works in the REPL but fails in Pulumi. I can cut-and-paste the error, but first wanted to make sure this wasn't a terrible idea. FWIW, this is just a personal setup, so I'm not super worried about how robust this is.
    s
    • 2
    • 5
  • m

    mysterious-piano-88140

    09/14/2021, 7:34 PM
    Hello all, I am using Pulumi for the first time for a project hosted in Azure cloud. I am using Typescript for programming the resources. I currently have the following scenario: A project with a stack named ‘dev’ that creates a ResourceGroup in Azure. The code is as follows: Another project with a stack named ‘dev’ that should create a MariaDB database and map it to the ResourceGroup just created in the other projet. My current code is this:
    export const databaseResourceGroup = new ResourceGroup(
      'resource-group-dev',
      {
        resourceGroupName: 'resource-group-dev',
        location: 'germanywestcentral',
        tags: {
          project: 'test',
          env: 'dev',
          type: 'resourcegroup'
        }
      }
    )
    My problem is that in the second project the ResourceGroup is not linked no matter how (getResourceGroup, Import, StackReference) but is always recreated, which leads to a fail because it just already exists.
    // const resourceGroup = await getResourceGroup({
    //   resourceGroupName: databaseResourceGroupName
    // })
    
    const resourceGroup = new ResourceGroup(
          'resource-group-dev',
          {
            resourceGroupName: 'resource-group-dev',
            location: 'germanywestcentral',
            tags: {
              project: 'test',
              env: 'dev',
              type: 'resourcegroup'
            }
          },
          {
            import: `/subscriptions/<subscription-id>/resourceGroups/<resourcegroupname>`
          }
        )
    Do any of you here have an idea how I can link between resources without recreating them. I would now expect a similar pattern as in the AWS CDK where I can access ARN with from methods.
    w
    • 2
    • 1
  • s

    square-car-84996

    09/16/2021, 4:14 AM
    Is there a lighter way of making a pulumi package... i really only care about typescript, and mainly just encapsulating/separating logic so my
    index.ts
    doesn't turn into a 10,000 line beast. I can't seem to find any examples where a project/stack isn't just a single index.ts file.
    l
    d
    p
    • 4
    • 4
  • b

    bumpy-laptop-30846

    09/16/2021, 12:32 PM
    Hello all, is there a way to debug a TS pulumi program inside and IDE like visual code or webstorm?
    l
    • 2
    • 2
  • l

    little-whale-73288

    09/21/2021, 9:35 AM
    Hello, how should I use
    pulumi.all
    on an input of type interface, that has fields of type
    pulumi.Input<string>
    , where I want to use the
    string
    value?
    l
    • 2
    • 2
  • r

    refined-terabyte-65361

    09/21/2021, 7:37 PM
    Hello I am trying to use pulumi to deploy aws elasticsearch I am getting id attached to domain name while creating resource how to make domain name to be static instead of attaching id
    const domainName = "example";
    const example = new aws.elasticsearch.Domain(domainName, {
      clusterConfig: {
        instanceType: "r4.large.elasticsearch",
      },
      elasticsearchVersion: "7.10",
      ebsOptions: {
        ebsEnabled: true,
        volumeSize: 10,
      },
      tags: {
        Domain: "TestDomain",
      },
    });
    output:
    example-03ef750
    Expecting
    example
    b
    l
    • 3
    • 11
  • r

    refined-terabyte-65361

    09/21/2021, 11:26 PM
    How to handle secrets in pulumi ? I am creating a resource with username and password how can i secure them while checking into git ? I have jenkins pipeline which triggers pulumi Is it possible to refer jenkins credentials from pulumi ?
    b
    l
    • 3
    • 3
  • r

    refined-terabyte-65361

    09/22/2021, 11:39 PM
    Hello I am trying to use this example https://www.pulumi.com/docs/reference/pkg/aws/elasticsearch/domainsamloptions/#basic-usage But i get error while trying to import fs I changed it to
    import * as fs from "fs";
    how to fix this ? Thanks
    s
    • 2
    • 1
  • l

    loud-bear-51491

    09/23/2021, 3:23 PM
    Hi.. I am new to typescript and trying to create an RDS Parameter Group.. I need to set these params:
    pg_stat_statements.track	ALL
    shared_preload_libraries	pg_stat_statements
    track_activity_query_size	2048
    due to lack of documentation i am not sure how i can achieve that.. can someone help me with this my code is below
    export const paramGroupPGStatStatement = new aws.rds.ParameterGroup("paramGroupPGStatStatement",
      {
        family: "postgres12",
        description: "Enabling pg_stat_statements"
      }
    );
    m
    • 2
    • 3
  • b

    better-baker-47643

    09/23/2021, 8:54 PM
    Are there any best practices for migrating large lambda functions over from serverless.com?
  • b

    better-baker-47643

    09/23/2021, 8:55 PM
    I had hoped the serialization magic would work, but it seems like complex imports / yarn workspaces completely break it
    b
    • 2
    • 1
  • b

    better-baker-47643

    09/23/2021, 8:55 PM
    considering going to back to serverless to manage lambda functions and then just import them in pulumi
  • m

    many-salesmen-89069

    09/24/2021, 4:11 PM
    Hi, I’m trying to implement a custom dynamic provider to upload files to S3. I’m currently stuck with this error:
    error: Error serializing '() => provider': index.js(28,47)
    
        '() => provider': index.js(28,47): captured
          variable 'provider' which indirectly referenced
            function 'S3UploadResourceProvider': s3Upload.ts(77,15): which referenced
              function 'create': s3Upload.ts(138,10): which referenced
                function 'uploadDirectoryToS3': s3Upload.ts(58,28): which referenced
                  function 'getFiles': s3Upload.ts(28,17): which captured
                    variable 'promises_1' which indirectly referenced
                      function 'readdir': which referenced
                        function 'getOptions': which captured
                          'ERR_INVALID_ARG_TYPE', a function defined at
                            function 'NodeError': which referenced
                              function 'isErrorStackTraceLimitWritable': which captured
                                'ObjectGetOwnPropertyDescriptor', a function defined at
                                  function 'getOwnPropertyDescriptor': which could not be serialized because
                                    it was a native code function.
    
        Function code:
          function getOwnPropertyDescriptor() { [native code] }
    Would appreciate any ideas on how to work around this 🙂
    b
    c
    • 3
    • 8
  • l

    little-whale-73288

    09/27/2021, 9:05 AM
    Hello, is it kosher to instantiate resource classes inside
    .apply
    callbacks?
    b
    • 2
    • 6
  • b

    billions-xylophone-85957

    09/30/2021, 5:58 PM
    hi all, how do you go about upgrading the
    @pulumi/pulumi
    with your yarns and npms? I just tried to upgrade 3.10 -> 3.13.2 and it somehow broke
    runtime.registerStackTransformation
    so I'm wondering if there is a non-obvious way to do so
    l
    • 2
    • 4
  • m

    most-lighter-95902

    10/01/2021, 4:12 AM
    Hi everyone - I hope this is the right channel for this question but I’m using javascript, not typescript and it looks like es6 is not supported? Any suggestions on how to enable es6 in a js project?
    l
    • 2
    • 5
  • l

    lemon-monkey-228

    10/01/2021, 2:36 PM
    Are there any patterns for deploying multiple pulumi projects?
  • l

    lemon-monkey-228

    10/01/2021, 2:36 PM
    I'm using yarn workspaces and I have
    projects/{a,b,c}
  • l

    lemon-monkey-228

    10/01/2021, 2:38 PM
    Just wondering if there's a way to share config between each of the pulumi project's stacks
    b
    s
    b
    • 4
    • 11
  • l

    lemon-monkey-228

    10/01/2021, 2:38 PM
    I could use js/ts imports, but it'd be nice to have some kind of central config too
  • l

    lemon-monkey-228

    10/01/2021, 2:38 PM
    even if I could add something like
    extraConfigs: ["../_shared/config.yaml"]
    to
    Pulumi.yaml
  • p

    proud-pizza-80589

    10/03/2021, 12:08 PM
    What is the current best practice to use a promise (await) in a ComponentResource? Obviously an await in the constructor does not work
    c
    • 2
    • 3
  • l

    loud-bear-51491

    10/04/2021, 3:46 PM
    Hi.. I am creating an account via pulumi in typescript
    const accountDev = new aws.organizations.Account( "dev", {
        name: "dev",
        email: "<mailto:xxxx@xxx.com|xxxx@xxx.com>",
        parentId: infrastructure.id,
        roleName: "admin",
    } );
    export const accountDevArn = accountDev.arn;
    export const accountIdDev = pulumi.output(accountDev).id;
    This works all good and i am exporting the arn and account id. In another file i am using the accountIdDev to create a policy for a user to assume role and use admin role to perform operations..
    import { accountIdDev } from "./accounts"
    
    const policy = new aws.iam.Policy( "devAssumePolicy", {
        path: "/",
        name: "devAssumePolicy",
        description: "assume policy for dev accounts created",
        policy: JSON.stringify( {
            "Version": "2012-10-17",
            "Statement": [
                {
                    "Action": [
                        "sts:AssumeRole"
                    ],
                    "Effect": "Allow",
                    "Resource": [
                        "arn:aws:iam::"+accountIdDev+":role/admin"
                    ]
                }
            ]
        } ),
    } );
    
    const attachPolicyInfra = new aws.iam.UserPolicyAttachment( "attachPolicyInfra", {
        user: "Infra-accounts-ci",
        policyArn: policy.arn,
    } );
    However i am struggling to get the accountIdDev and its giving malformed policy.. Can some help in telling what am i doing wrong here.. Thanks!
    g
    l
    • 3
    • 7
  • r

    refined-terabyte-65361

    10/04/2021, 10:07 PM
    Hello I am using pulumi typescript to upgrade gke cluster node pool and clontrol plane of gke takes more than default timeout of 20m how to increase timeout while pulumi up
    Error waiting for updating GKE node pool version: timeout while waiting for state to become 'DONE' (last state: 'RUNNING', timeout: 20m0s)
    r
    • 2
    • 1
  • d

    dry-football-2639

    10/05/2021, 12:49 PM
    TypeScript question: How to handle 
    async/await
     operations inside the ComponentResource constructor (like resource getters)? If I can't do 
    await
     in the constructor, can I ever be sure that Pulumi will respect the dependency order (that the resources I pass as dependencies will be properly awaited before constructing the resource)?
    class DelegatedPublicDnsZone extends pulumi.ComponentResource {
      public output: DnsZone
    
      constructor(
        name: string,
        args: DelegatedPublicDnsZoneArgs,
        opts: pulumi.ComponentResourceOptions = {}
      ) {
        super('dixa:iac:DnsZone', name, {}, opts)
    
        const { zone, getConventionName } = args
    
        if (zone.id) {
          const r53Zone = await aws.route53.getZone({ <--- await cannon be used in constructor
            zoneId: zone.id,
          })
          this.output = {
            id: pulumi.output(r53Zone.id),
            domainName: pulumi.output(r53Zone.name),
          }
        }
    c
    e
    • 3
    • 2
Powered by Linen
Title
d

dry-football-2639

10/05/2021, 12:49 PM
TypeScript question: How to handle 
async/await
 operations inside the ComponentResource constructor (like resource getters)? If I can't do 
await
 in the constructor, can I ever be sure that Pulumi will respect the dependency order (that the resources I pass as dependencies will be properly awaited before constructing the resource)?
class DelegatedPublicDnsZone extends pulumi.ComponentResource {
  public output: DnsZone

  constructor(
    name: string,
    args: DelegatedPublicDnsZoneArgs,
    opts: pulumi.ComponentResourceOptions = {}
  ) {
    super('dixa:iac:DnsZone', name, {}, opts)

    const { zone, getConventionName } = args

    if (zone.id) {
      const r53Zone = await aws.route53.getZone({ <--- await cannon be used in constructor
        zoneId: zone.id,
      })
      this.output = {
        id: pulumi.output(r53Zone.id),
        domainName: pulumi.output(r53Zone.name),
      }
    }
c

curved-pharmacist-41509

10/05/2021, 12:54 PM
You should be able to pulumi.output(aws.route53.getZone(..)) Then you can access .id on the output without doing anything special
e

echoing-actor-55539

10/06/2021, 12:43 AM
I do something like this:
export const siteZone = aws.route53.Zone.get(
  'siteZone',
  aws.route53.getZone(
    { name: '<http://my.zone.com|my.zone.com>', privateZone: false }
  ).then(zone => zone.id),
  {}
);
View count: 1