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

    important-ram-83431

    06/27/2019, 9:18 AM
    Hi guys, I'm trying to Request and Validate a certificate through Pulumi TS code: const doDomainCert = new aws.acm.Certificate("devops-certificate", { domainName: devopsDomainWildcard, validationMethod: "DNS", }); const certValidation = new aws.route53.Record("devops-certificate-validation-dns", { name: doDomainCert.domainValidationOptions[0].resourceRecordName, zoneId: route53zone.id, type: doDomainCert.domainValidationOptions[0].resourceRecordType, records: [doDomainCert.domainValidationOptions[0].resourceRecordValue], ttl: 10, });
  • i

    important-ram-83431

    06/27/2019, 9:20 AM
    But facing an error, because: doDomainCert.domainValidationOptions[0].resourceRecordType is an Output<string> and we need a Input<aws.route53.RecordType>; and I'm unable to figure out how to get that
  • i

    important-ram-83431

    06/27/2019, 9:20 AM
    I've tried that
  • i

    important-ram-83431

    06/27/2019, 9:21 AM
    But when executing "pulumi up" raises an error because not able to execute .get() on Update or Preview
  • i

    important-ram-83431

    06/27/2019, 9:31 AM
    -.ts
    👍 1
  • i

    important-ram-83431

    06/27/2019, 9:31 AM
    Sorry guys, I finally found the answer myself
  • o

    orange-tailor-85423

    06/27/2019, 4:26 PM
    Thanks for posting Albert! I like going back through and reading solutions
  • g

    glamorous-thailand-23651

    06/27/2019, 9:59 PM
    Hi folks- I’m trying to instantiate & use a kubernetes config from another stack and having trouble getting the argument types right. Can anyone point me in the right direction? code and error message follows in thread.
    b
    s
    • 3
    • 6
  • f

    fierce-pager-95248

    06/28/2019, 11:07 PM
    i've been trying very hard to get this sample envoy sidecar deployment to work that's highlighted on the site.
    import * as k8s from '@pulumi/kubernetes';
    import * as k8sInput from '@pulumi/kubernetes/types/input';
    import * as pulumi from '@pulumi/pulumi';
    
    export class EnvoyDeployment extends k8s.apps.v1.Deployment {
        constructor(name: string,
                    args: k8stypes.apps.v1.Deployment,
                    opts?: pulumi.CustomResourceOptions) {
            const pod = args.spec.template.spec;
    
            // Add an Envoy sidecar container.
            pod.containers = pod.containers || [];
            pod.containers.push({
                name: "envoy",
                image: "lyft/envoy:latest",
                command: ["/usr/local/bin/envoy"],
                args: [
                    "--concurrency 4",
                    "--config-path /etc/envoy/envoy.json",
                    "--mode serve"
                ],
                ports: [{ containerPort: 80, protocol: "TCP" }],
                resources: {
                    limits: { cpu: "1000m", memory: "512Mi" },
                    requests: { cpu: "100m", memory: "64Mi" }
                },
                volumeMounts: [{ name: "envoy-conf", mountPath: "/etc/envoy" }]
            });
    
            // Add an associated Volume for Envoy's config, mounted as a ConfigMap.
            pod.volumes = pod.volumes || [];
            pod.volumes.push({
                name: "envoy-conf", configMap: { name: "envoy" },
            });
    
            super(name, args, opts);
        }
    }
    but the compiler is giving my fits
    Property 'template' does not exist on type 'Input<DeploymentSpec>'.
      Property 'template' does not exist on type 'Promise<DeploymentSpec>'.
    on
    const pod = args.spec.template.spec;
    Is this no longer a valid example? Could anyone help point out what I'm missing here?
  • w

    wooden-room-54680

    06/30/2019, 8:47 PM
    What's the best practice for working with
    ComponentResourceOptions.providers
    ? I see pulumi has an internal function
    convertToProvidersMap
    to convert from
    Record<string, ProviderResource> | ProviderResource[]
    to map, but it's not exported. I need to pass the provider to a kubernetes resource inside a component.
    w
    • 2
    • 2
  • g

    glamorous-waitress-51149

    07/02/2019, 4:08 PM
    anyone know if this works as i seem to get a vpc with no properties set
  • g

    glamorous-waitress-51149

    07/02/2019, 4:08 PM
    const primaryVpc = awsx.ec2.Vpc.fromExistingIds("primary", {
        vpcId: primaryVpcId
    });
  • g

    glamorous-waitress-51149

    07/03/2019, 8:30 AM
    left a question here too https://stackoverflow.com/questions/56866257/retrieve-a-vpc-to-create-a-security-group
  • m

    microscopic-airline-90245

    07/11/2019, 4:58 PM
    Hi guys, I can't figure out how to provide a private registry secret when overriding a Helm chart with a private repo image. I must be doing something wrong (I hope), but the error message is rather unhelpful. A simplified case here: https://gist.github.com/mamash/4f6d587392ddf096d3bdcd2d172be161
  • j

    jolly-egg-4894

    07/12/2019, 9:23 PM
    I have emails with zips so
    SES -> S3 -> Lambda
    which works just fine. but now I want to have 2
    onObjectCreate
    lambdas either: on the same bucket looking at different prefixes (
    SES -> S3 'email prefix' -> Lambda 1 -> S3 -> 'other prefix' -> Lambda 2
    ) or a clean way to do
    SES -> S3 1 -> Lambda 1 -> S3 2 -> Lambda 2
    • 1
    • 3
  • e

    early-match-56268

    07/13/2019, 12:27 PM
    Has anyone successfully retrieved outputs from a dynamic resource? Trying to figure out if I am doing something wrong. Issue and code I am using: https://github.com/pulumi/pulumi/issues/2931
  • m

    modern-bear-85657

    07/15/2019, 6:58 PM
    Re-asking here as I never got a response in #general. I’m also seeing this issue when attempting to init a new project:
    $ pulumi new aws-typescript
    This command will walk you through creating a new Pulumi project.
    
    Enter a value or leave blank to accept the (default), and press <ENTER>.
    Press ^C at any time to quit.
    
    project name: (my-project) <org>/my-project
    Sorry, '<org>/my-project is not a valid project name. A project name may only contain alphanumeric, hyphens, underscores, and periods.
    w
    • 2
    • 3
  • l

    loud-sugar-50419

    07/16/2019, 6:37 AM
    hi new to typescript and pulumi trying to move from terraform I was implementing the idea of tdd based on the blog by Joe Duffy https://www.pulumi.com/blog/unit-testing-infrastructure-in-nodejs-and-mocha/ Had the following issue with promise function demo by Joe Duffy
    return (output as any).promise() as Promise<T>;
    when I try to export a security group const awsx.ec2.SecurityGroup and then try to test all the ingressRules which is an array it will fail as there is no promise function to the array. So I changed the promise if the output is not of type OutputImpl then convert it to an output and then use it
    export function promise<T>(output: pulumi.Output<T>): Promise<T | undefined> {
        if (output.constructor.name != 'OutputImpl'){
            return (pulumi.output(output) as any).promise() as Promise<T>;
      }else
        {
           return (output as any).promise() as Promise<T>;
       }
    }
    and then in the spec test I got the array[]
    const ssh_rule:Array<awsx.ec2.IngressSecurityGroupRule> | undefined = await promise(baseVpc.baseSgObj.ingressRules);
    how do I get all the cidrblocks as If I call the promise function
    promise(baseVpc.baseSgObj.ingressRules[0].securityGroupRule.cidrBlocks)
    specifying the array index it will work as the object implements an output which has a promise. How to convert pulumi output back to its original form ?
  • l

    loud-sugar-50419

    07/16/2019, 8:34 AM
    I have resolved it like this . But I don't know if this is the best way to do it
    if(ssh_rule){
                ssh_rule.map(item => { 
                    item.securityGroupRule.cidrBlocks.apply( (i) => {
                        expect(i).not.contain("0.0.0.0/0")
                    })
                 })
         }
  • j

    jolly-egg-4894

    07/16/2019, 8:37 AM
    You can paste blocks a bit easier by just putting it like this:
    ```
    if(ssh_rule){
        ssh_rule.map(item => {
            item.securityGroupRule.cidrBlocks.apply((i) => {
                expect(i).not.contain("0.0.0.0/0")
            })
        })
    }
    ```
  • j

    jolly-egg-4894

    07/16/2019, 8:37 AM
    becomes this:
    if(ssh_rule){
        ssh_rule.map(item => {
            item.securityGroupRule.cidrBlocks.apply((i) => {
                expect(i).not.contain("0.0.0.0/0")
            })
        })
    }
  • l

    loud-sugar-50419

    07/16/2019, 8:40 AM
    thanks @jolly-egg-4894
  • f

    fierce-cpu-94517

    07/16/2019, 1:42 PM
    Hi, I have the following aws vpc configuration:
    export const vpc = new awsx.ec2.Vpc("vpc", {
       numberOfAvailabilityZones: 3,
    });
    I'm struggling to find a way to grab the private subnet so that I can use it to create an EC2 instance. This is what I came to thus far:
    const privateSubnets = pulumi.output(vpc.privateSubnets).apply(
        subnets => subnets.filter(x => x.subnet.availabilityZone == pulumi.output("us-east-1a"))
    );
    
    export const server = new aws.ec2.Instance("server", {
        instanceType: aws.ec2.C5InstanceLarge,
        vpcSecurityGroupIds: [ vpc.sgInternal.id ],
        subnetId: privateSubnets.apply(x => x[0].id),
        ami: "ami-;02507631a9f7bc956",
    });
    I'm getting the following error:
    $ pulumi up
    Previewing update (xxx):
    
         Type                 Name                      Plan     Info
         pulumi:pulumi:Stack  xxx           1 error; 5 messages
     
    Diagnostics:
      pulumi:pulumi:Stack (xxx):
        TypeError: Cannot read property 'id' of undefined
            at exports.server.aws.ec2.Instance.subnetId.privateSubnets.apply.x (ec2.ts:24:46)
            at OutputImpl.<anonymous> (node_modules/@pulumi/pulumi/output.js:104:47)
            at Generator.next (<anonymous>)
            at fulfilled (node_modules/@pulumi/pulumi/output.js:17:58)
    g
    • 2
    • 7
  • a

    ambitious-van-68615

    07/16/2019, 4:20 PM
    Hi, sorry if my problem has been answered previously, but I searched and couldn't find it. I apply the gcp-ts-serverless-raw sample (https://github.com/pulumi/examples/tree/master/gcp-ts-serverless-raw) in order to deploy several Cloud Functions. Everything is alright but I can't figure out how to set my function name without any random string at the end. My function part is :
    const functionhw = new gcp.cloudfunctions.Function(functionName, {
      sourceArchiveBucket: bucket.name,
      runtime: "nodejs10",
      sourceArchiveObject: bucketObjecthw.name,
      entryPoint: "helloGet",
      httpsTriggerUrl: `<https://us-central1-project-id.cloudfunctions.net/${functionName}>`,
      triggerHttp: true,
    });
    Even if I use really unique values (both for my project and globally), it sets this suffix
    b
    • 2
    • 6
  • s

    salmon-beard-79336

    07/17/2019, 2:29 PM
    export interface CosmosContainerArgs {
        region: pulumi.Input<string>;
        endpoint: pulumi.Input<string>;
        masterKey: pulumi.Input<string>;
        client: any;
    }
    
    class MyResource extends pulumi.dynamic.Resource {
        constructor(name: string, props: MyResourceInputs, opts?: pulumi.CustomResourceOptions) {
            let region = args.region;
            let endpoint = args.endpoint;
            let masterKey = args.masterKey;
    
            let connectionPolicy = new cosmos.ConnectionPolicy();
            connectionPolicy.PreferredLocations = [args.region];
    
            const client = new cosmos.CosmosClient({
                endpoint,
                auth: { masterKey },
                connectionPolicy,
            });
    
            args.client = client;
    
            super(myprovider, name, props, opts); 
        }
    }
    Trying to initialise a custom client in the resource constructor, so the I can pass it on to the provider to work with. What is the best way to approach this? The above fails because
    arg.region
    returns
    Promise
    Type 'Input<string>' is not assignable to type 'string'.
      Type 'Promise<string>' is not assignable to type 'string'.
    w
    t
    • 3
    • 8
  • s

    salmon-beard-79336

    07/17/2019, 2:40 PM
    maybe not the right approach, so any ideas are most than welcome. Trying to add manually the ability to CRUD a CosmosDB Container in Azure
  • i

    incalculable-lock-7238

    07/17/2019, 2:55 PM
    hmm so having issues w/ vpc.id for elasticsearch :
    const cluster = new eks.Cluster(clusterName, {
        vpcId: vpc.id,
        subnetIds: vpc.privateSubnetIds,
        instanceType: instanceType,
        desiredCapacity: desiredCapacity,
        minSize: minSize,
        maxSize: maxSize,
        storageClasses: storageClass,
        deployDashboard: deployDashboard
    });
    ...
    let es = new aws.elasticsearch.Domain(
        "elasticsearch",
        {   
              ....
            vpcOptions: {
                vpcId: vpc.id,
                subnetIds: vpc.privateSubnetIds
            }
        }
    );
    getting a
    Diagnostics:
      aws:elasticsearch:Domain (elasticsearch):
        error: aws:elasticsearch/domain:Domain resource 'elasticsearch' has a problem: "vpc_options.0.vpc_id": this field cannot be set
    how can this be set properly?
  • i

    incalculable-lock-7238

    07/17/2019, 3:27 PM
    nvm, solved it cause of this : https://github.com/terraform-providers/terraform-provider-aws/issues/7022
  • l

    loud-sugar-50419

    07/18/2019, 6:35 AM
    is there a good example of aws appmesh with ecs thats done in typescript
    w
    • 2
    • 1
  • l

    limited-rainbow-51650

    07/18/2019, 9:49 PM
    I guess more of a Typescript question than a Pulumi question, but how can I spread a large set of resources over multiple
    .ts
    files, all called from
    index.ts
    ?
    w
    • 2
    • 7
Powered by Linen
Title
l

limited-rainbow-51650

07/18/2019, 9:49 PM
I guess more of a Typescript question than a Pulumi question, but how can I spread a large set of resources over multiple
.ts
files, all called from
index.ts
?
w

white-balloon-205

07/18/2019, 9:50 PM
Just import all the other files into
index.ts
- right?
l

limited-rainbow-51650

07/18/2019, 9:51 PM
Guess so, but my attempt doesn’t seem to work.
w

white-balloon-205

07/18/2019, 9:51 PM
See something like https://github.com/pulumi/examples/blob/master/azure-ts-aks-mean/index.ts
If you want to import from another file but not actually reference any outputs, TypeScript has an unfortunate rule that you have to use the
import "./foo"
form.
See https://github.com/Microsoft/TypeScript/issues/9191.
l

limited-rainbow-51650

07/18/2019, 9:55 PM
Indeed, bitten by that TS issue.
Tnx.
View count: 1