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

    salmon-beard-79336

    11/04/2019, 12:22 PM
    Trying to access the
    principalId
    from the
    identity
    property of API Management service:
    export const dump = service.identity.principalId
    However, it seems that accessing properties of
    identity
    is not doable for some reason:
    error TS2339: Property 'principalId' does not exist on type 'Output<ServiceIdentity | undefined>'.
    Property 'principalId' does not exist on type 'OutputInstance<ServiceIdentity | undefined> & LiftedObject<undefined, never>'.
    But the outputs of apimanagement say it should be possible
    interface ServiceIdentity {
            /**
             * The Principal ID associated with this Managed Service Identity.
             */
            principalId: string;
            /**
             * The Tenant ID associated with this Managed Service Identity.
             */
            tenantId: string;
            type: string;
        }
    Am I missing anything? …. Forgot to mention that outputting the
    identity
    object works as expected
    ~ dump: {
          + dump: {
              + principalId: "9f9e1f60-933e-49b5-b6a3-7c416e2b542a"
              + tenantId   : "152e4c75-3657-4284-bb2c-0d825873d72b"
              + type       : "SystemAssigned"
            }
        }
  • t

    tall-librarian-49374

    11/04/2019, 12:26 PM
    Try
    service.identity.apply(id => id && id.principalId);
    👌 1
  • t

    tall-librarian-49374

    11/04/2019, 12:27 PM
    The fact that
    identity
    is not always there (
    | undefined
    ) makes it a bit harder to use.
  • s

    salmon-beard-79336

    11/04/2019, 12:28 PM
    and any particular reason that’s not always there?
  • t

    tall-librarian-49374

    11/04/2019, 12:29 PM
    You don't have to configure identity for the API management
    👍 1
  • c

    creamy-shoe-96075

    11/04/2019, 1:51 PM
    hi everyone, can anybody point me an example how to set up logs in Azure App service ?
    azure.appservice.AppService
    t
    • 2
    • 8
  • m

    melodic-family-5784

    11/04/2019, 6:38 PM
    Hello All, I am new to Pulumi and TypeScript. I've been trying to extend the example at...https://www.pulumi.com/blog/get-started-with-docker-on-aws-fargate-using-pulumi/ to include a statsd sidecar. I am currently stuck trying to define the containerPorts. I've tried the following:
    const statsdPortProtocol: aws.ecs.Protocol = 'udp';
    const statsdAdminPortProtocol: aws.ecs.Protocol = 'tcp';
    const statsdPort = { port: 8125, protocol: statsdPortProtocol };
    const statsdAdminPort = { port: 8126, protocol: statsdAdminPortProtocol };
    and used it as
    portMappings: [statsdPort, statsdAdminPort]
    but I am getting the error:
    Invalid 'containerPort' setting for container 'statsd'.
    q
    • 2
    • 3
  • m

    mammoth-account-65260

    11/06/2019, 9:14 PM
    Hi, how do I enable CORS on per method basis for AWS API gateway?
    t
    • 2
    • 6
  • a

    ancient-plastic-80816

    11/07/2019, 8:28 PM
    Anyone that have links or information regarding moving Digitalocean infrastructure from Terraform to Pulumi? It's not very big and most things was taken care of by tf2pulumi and then some manual edits to add in
    {import:"resource id"}
    . Problem is that some resources give warnings like the following, while the inputs are configured exactly the same as previous TF code and is correct in relation to the existing TF state. 🤔 And if I run
    terraform plan
    there are no changes to be made, so there should not be any wild configuration changes floating around.
    digitalocean:index:Droplet (mgr):
        warning: inputs to import do not match the existing resource; importing this resource will fail
    g
    • 2
    • 5
  • s

    stocky-island-3676

    11/08/2019, 1:41 PM
    How do you reference a NodeJS module in a Git subdirectory with
    npm
    ? The only solution I’ve found so far seems to be switching to
    yarn
    at all. (see https://github.com/npm/npm/issues/2974 -> https://npm.community/t/allow-installing-packages-from-git-subdirectories/3973)
    f
    • 2
    • 3
  • b

    brave-window-69382

    11/11/2019, 1:32 PM
    I am very new to TypeScript so I'm hoping this is an easy question for someone else. I have a functional loop that is creating/importing our IAM groups from a text file: const groupsList = (fs.readFileSync('groups.txt')).toString().split('\n') let groups = []; for (let group in groupsList) { groups.push(new aws.iam.Group(groupsList[group], {name: groupsList[group]}, {import: groupsList[group]})); } export let groupNames = groups.map(s => s.name); Later on, I want to re-use the created groups in a aws.iam.GroupPolicyAttachment resource: const groupPolicyAttachment = new aws.iam.GroupPolicyAttachment("testGroupoAttachment", { group: (<groupType export goes here>})), policyArn: testPolicy.arn }); The groupPolicyAttachment doesn't accept a string value for group attribute. I'm trying to figure out how to get the original groupType from the original loop. The current export was just a test, but again, I end up with a string value.
    q
    • 2
    • 1
  • c

    chilly-crayon-57653

    11/12/2019, 8:31 PM
    set the channel topic: All TypeScript all the time! Noob friendly - there are no dumb questions.
  • a

    acceptable-army-69872

    11/14/2019, 7:23 PM
    Trying to upload docker image to a repo...
    // import { Repository, RepositoryImage } from "@pulumi/awsx/ecr";
    
    export function createImage() : RepositoryImage {
      const repository = new Repository("myrepo");
      const repImage = repository.buildAndPushImage("./Application");
    
      return repImage
    }
    and I get this error on the return line
    error TS2739: Type 'OutputInstance<string> & LiftedObject<String, number | "length">' is missing the following properties from type 'RepositoryImage': repository, imageValue, image, environment
    . If I change
    createImage() : RepositoryImage
    to any I get a string error...whats going on here?
    b
    l
    • 3
    • 23
  • a

    acceptable-army-69872

    11/14/2019, 7:25 PM
    I have 0.18.13 for the awsx library, https://github.com/pulumi/pulumi-awsx/blob/v0.18.13/nodejs/awsx/ecr/repository.ts#L70 indicates that's the right type...
  • s

    stocky-island-3676

    11/14/2019, 8:09 PM
    Typescript question: How can I append an additional field & value to an existing variable of type
    pulumi.ComponentResourceOptions
    ? I want to add
    dependsOn
    to a
    kubernetesOptions
    variable defined beforehand.
    w
    b
    • 3
    • 4
  • s

    stocky-island-3676

    11/14/2019, 8:35 PM
    Is it possible to set
    import:
    for resources in a
    helm.v2.Chart()
    as well? (See https://www.pulumi.com/blog/adopting-existing-cloud-resources-into-pulumi/) Maybe via
    transformations
    ?
    w
    • 2
    • 1
  • n

    nutritious-battery-42762

    11/15/2019, 4:48 PM
    links aren't supported with fargate so how can i do depends on ? trying to get nignx container to connect to php container
    const appService = new awsx.ecs.FargateService("app-svc2", {
        cluster,
        taskDefinitionArgs: {
            containers: {
                php: {
                    image: img,
                    cpu: 102 /*10% of 1024*/,
                    memory: 50 /*MB*/,
                    essential: true
                },
                nginx: {
                    image: nginx,
                    cpu: 102 /*10% of 1024*/,
                    memory: 50 /*MB*/,
                    portMappings: [web],
                    essential: true,
                    
                },
            }
        },
        desiredCount: 2
    });
    w
    f
    b
    • 4
    • 7
  • r

    rhythmic-finland-36256

    11/18/2019, 10:14 AM
    Best practice on handling
    pulumi.Output
    when using helper functions that want unboxed values (and especially reusing the result for a new pulumi resource name)
    b
    • 2
    • 10
  • h

    happy-parrot-60128

    11/21/2019, 3:07 PM
    Is there a quick way to generate and view the package that would be deployed for a given lambda? Trying to diagnose some node module packaging issues, but don’t want to deploy to an actual environment to be able to view the compiled code
  • n

    nice-guitar-97142

    11/21/2019, 3:53 PM
    @happy-parrot-60128 would
    pulumi preview
    do that for you?
    h
    • 2
    • 2
  • q

    quaint-artist-58613

    11/28/2019, 10:54 PM
    I knew we can do stack reference in the same aws account like this:
    import * as pulumi from "@pulumi/pulumi";
    const current_stack = pulumi.getStack(); // assume current_stack deployed into account A
    const infra_stack = new pulumi.StackReference(`acmecorp/infra/${current_stack}`);  // assume infra_stack also deployed into account A
    But is there a way to do stackreference across aws accounts ?
    import * as pulumi from "@pulumi/pulumi";
    const current_stack = pulumi.getStack();  // assume current_stack deployed into account A
    const infra_stack = new pulumi.StackReference(`acmecorp/infra/${current_stack}`); // assume infra_stack deployed into account B, does this really work ?
    Thanks.
    w
    • 2
    • 1
  • b

    bored-jackal-93148

    12/08/2019, 11:44 PM
    is there a way to set the package manager used by the pulumi cli? I prefer to use
    pnpm
    rather than
    npm
    or ``yarn``
    w
    s
    • 3
    • 6
  • p

    plain-eye-9759

    12/10/2019, 10:22 AM
    Does Pulumi support something like config flattening, such that you could have something like
    base.yaml
    that
    pulumi.dev.yaml
    , and
    pulumi.staging.yaml
    can share some common values from the base?
    t
    w
    a
    • 4
    • 4
  • h

    handsome-truck-95168

    12/11/2019, 7:17 PM
    Is there a template repo or something I can clone so I can quickly reproduce a bug? That is, what's the shortest path to working typescript/aws code that demonstrates (what I htink) is a bug?
    • 1
    • 1
  • h

    handsome-truck-95168

    12/11/2019, 7:43 PM
    I think it's impossible to, in one deployment, create an SSL certificate and DNS entries to validate that certificate for a domain with multiple "subjectAlternativeNames" in a general way.
    w
    • 2
    • 6
  • g

    glamorous-waitress-51149

    12/12/2019, 11:33 AM
    anyone about to answer a noob question in #general ? Probably should have put it in here
  • a

    astonishing-cartoon-37000

    12/12/2019, 5:55 PM
    has something changed with
    ComponentResourceOptions
    ? i'm getting
    index.ts(29,47): error TS2322: Type 'Provider' is not assignable to type 'ProviderResource'.
          Types of property 'id' are incompatible.
    when trying to
    const k8sProvider = new k8s.Provider(`cointainers-${environment}`, {
            kubeconfig: fs.readFileSync(`.circleci/${environment}.json`).toString()
        })
    
    const t = new test({provider: k8sProvider}) // <---- pass provider as options to class which extends pulumi.ComponentResource
    
    class test extends pulumi.ComponentResource {
        constructor(opts?: pulumi.ComponentResourceOptions) {
            super('test', "test", {}, opts)
        }
    }
    w
    l
    • 3
    • 25
  • r

    rhythmic-hair-33677

    12/12/2019, 8:31 PM
    I am experimenting with using
    pulumi.ComponentResource
    to build in some validation logic. What I am seeing is that if I throw a
    pulumi.ResourceError
    pulumi prints it twice with a stack trace. It appears that pulumi.ResourceError ignores my “hideStack = true” parameter. It also appears that apply occurs before or regardless of an error creating the output. I’m probably doing something wrong here, but I would like to have a single nice error displayed w/o the stack and only perform validation if the underlying resource create succeeds.
    w
    • 2
    • 3
  • r

    rhythmic-hair-33677

    12/12/2019, 9:56 PM
    It appears that if any error is thrown inside of an apply() the error will be printed twice for the stack + the error itself.
    w
    • 2
    • 1
  • b

    busy-magazine-48939

    12/13/2019, 4:29 AM
    Hello, I’ve EIP that is associated privateIp address of the instance, how do I add EIP into inbound rules of the security group attached to that instance, chicken and egg problem? I’m getting:
    TypeError: Cannot read property 'publicIp' of undefined
    const sgc = new aws.ec2.SecurityGroup('sg-c', {
      vpcId: vpcId,
      name: `${baseTags.Prefix}-intranet-sg`,
      ingress: [{
        protocol: 'tcp',
        fromPort: 1521,
        toPort: 1521,
        cidrBlocks: [`${vmaEip.publicIp}/32`],
      }],
      tags: baseTags
    })
    const vma = new aws.ec2.Instance('vm-a', {
      tags: { Name: `${baseTags.Prefix}-vm-a`, ...baseTags },
      instanceType: 't3.xlarge',
      vpcSecurityGroupIds: [sgc.id],
      ami: AMI_ID,
      subnetId: subnetId,
      keyName: deployer.keyName,
      privateIp: VMA_IP
    }, { deleteBeforeReplace: true })
    const vmaEip = new aws.ec2.Eip("vm-a-eip", {
      associateWithPrivateIp: vma.privateIp,
      instance: vma.id,
      vpc: true,
      tags: baseTags
    })
    w
    • 2
    • 4
Powered by Linen
Title
b

busy-magazine-48939

12/13/2019, 4:29 AM
Hello, I’ve EIP that is associated privateIp address of the instance, how do I add EIP into inbound rules of the security group attached to that instance, chicken and egg problem? I’m getting:
TypeError: Cannot read property 'publicIp' of undefined
const sgc = new aws.ec2.SecurityGroup('sg-c', {
  vpcId: vpcId,
  name: `${baseTags.Prefix}-intranet-sg`,
  ingress: [{
    protocol: 'tcp',
    fromPort: 1521,
    toPort: 1521,
    cidrBlocks: [`${vmaEip.publicIp}/32`],
  }],
  tags: baseTags
})
const vma = new aws.ec2.Instance('vm-a', {
  tags: { Name: `${baseTags.Prefix}-vm-a`, ...baseTags },
  instanceType: 't3.xlarge',
  vpcSecurityGroupIds: [sgc.id],
  ami: AMI_ID,
  subnetId: subnetId,
  keyName: deployer.keyName,
  privateIp: VMA_IP
}, { deleteBeforeReplace: true })
const vmaEip = new aws.ec2.Eip("vm-a-eip", {
  associateWithPrivateIp: vma.privateIp,
  instance: vma.id,
  vpc: true,
  tags: baseTags
})
w

white-balloon-205

12/13/2019, 5:30 AM
See
pulumi.interpolate
. https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs-and-strings
b

busy-magazine-48939

12/13/2019, 7:29 AM
Thanks @white-balloon-205, I tried to use both
concat
and
interpolate
but it doesn’t make any effect, still getting same error
Although, I noticed that
interpolate
works within module where EIP resource is defined, but if I try to interpolate it in another module referenced via import {} then it fails
The only way I could make it work is to use
concat(stack.getOutput('outputId'))
, however my understanding always was that
getOutput()
is meant to be used for cross-stack references primarily, is my understanding wrong? Is it feasible to use
stack.getOutput()
within one stack?
View count: 1