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
general
  • b

    billowy-laptop-45963

    06/27/2019, 6:44 PM
    Have any of you started out with the python SDK and switched to the TS one after? If so why?
  • g

    glamorous-thailand-23651

    06/27/2019, 6:47 PM
    i tried TS, went to python, then back to TS.
  • g

    glamorous-thailand-23651

    06/27/2019, 6:49 PM
    TS seems to be the most featureful SDK, but python is my preferred language. so i tried to see if i could accomplish the same task (awsx getting started with EKS and some helm charts) in python that i had in TS… it seemed like a lot more work, and examples were much more limited, so i ended up switching back
  • h

    handsome-actor-1155

    06/27/2019, 6:55 PM
    I like the strong typing you get in TS. Makes my code less error prone, especially when working with a new and unfamiliar SDK
  • b

    boundless-monkey-50243

    06/27/2019, 7:00 PM
    Some of my developers wanted to use Python, but it was a pretty quick trip to convince them to use TypeScript instead. Too many missing tools, too little typechecking.
  • w

    worried-engineer-33884

    06/27/2019, 7:20 PM
    if i am instantiating a second aws provider, e.g.:
    const otherProvider = new aws.Provider("otherProvider")
    do i have to do anything special to run mocha unit tests on things that use that provider?
    g
    • 2
    • 11
  • w

    worried-engineer-33884

    06/27/2019, 10:10 PM
    Is there a way to assert that an output is a secret output? It seems that the property and helper function for this are both marked
    @internal
    . Is there another way?
    w
    • 2
    • 6
  • d

    dazzling-scientist-80826

    06/27/2019, 11:02 PM
    i’m trying to do
    aws.cloudwatch.LogGroup.get(name, logGroupName)
    where
    logGroupName
    is a computed value like
    /aws/lambda/${lambda.name}
    - this works, but if there were no log messages written by the lambda yet (ie on an initial deploy) subsequent resource creations that reference the log group fail with
    The specified log group does not exist
    - any recommendations on how to solve this chicken and egg problem?
    w
    • 2
    • 2
  • g

    glamorous-thailand-23651

    06/27/2019, 11:18 PM
    linking this here for visibility 🙂 https://pulumi-community.slack.com/archives/CJ909TL6P/p1561672755058900
  • c

    crooked-jordan-34725

    06/28/2019, 3:42 AM
    Hey y’all! First of all my world has been officially rocked. Pulumi is awesome. The ability to use typescript, the flexibility of the SDK and the magic functions have allowed me to rewrite a Serverless stack really fast.
  • c

    crooked-jordan-34725

    06/28/2019, 3:49 AM
    I’m a little stuck with something regarding magic functions though. I’ve tried leaving compilation to Pulumi, and also doing it myself, and I always get this when I run any of the compiled lambdas: module initialization error: TypeError at Symbol.[Symbol.toPrimitive] (anonymous) at Object.anonymous (/var/task/__index.js7️⃣20) at Module._compile (module.js:652:30)
  • c

    crooked-jordan-34725

    06/28/2019, 3:49 AM
    Did anyone run into this problem?
    w
    • 2
    • 7
  • m

    modern-bear-85657

    06/28/2019, 1:52 PM
    Regarding reusability: I’m wanting to build a reusable library of sensible defaults for the various teams in my org, such as account number, default tags, etc. If I define these in stacks, will they be available/reusable when imported into another project?
    g
    • 2
    • 13
  • b

    busy-umbrella-36067

    06/28/2019, 3:27 PM
    I'm getting a sort-of race condition when using an IAM role to create an AWS provider. Pulumi tries to assume the role immidiately before IAM has a chance to register the permissions. An apply results in
    error: The role "arn:aws:iam::xxx:role/xxx" cannot be assumed.
    Running
    pulumi update
    a second time, after the role has been fully created successfully creates a useable provider.
    import * as aws from "@pulumi/aws";
    
    const role = new aws.iam.Role("testrole", {
      assumeRolePolicy: aws.getCallerIdentity().then(id => {
        return {
          Version: "2012-10-17",
          Statement: [
            {
              Effect: "Allow",
              Principal: {
                AWS: `arn:aws:iam::${id.accountId}:root`
              },
              Action: "sts:AssumeRole"
            }
          ]
        };
      })
    });
    
    const rolePolicy = new aws.iam.Policy("test", {
      description: "Full S3 Admin",
      policy: {
        Version: "2012-10-17",
        Statement: [
          {
            Effect: "Allow",
            Action: "s3:*",
            Resource: "*"
          }
        ]
      }
    });
    
    const rolePolicyAttachment = new aws.iam.RolePolicyAttachment("test", {
      policyArn: rolePolicy.arn.apply(arn => arn),
      role: role
    });
    
    const roleProvider = new aws.Provider(
      "test",
      {
        assumeRole: {
          roleArn: role.arn
        }
      },
      { dependsOn: rolePolicyAttachment }
    );
    
    // try to make an s3 bucket using role provider
    // this will fail once and then work
    const s3Bucket = new aws.s3.Bucket(
      "test",
      {},
      { provider: roleProvider, dependsOn: roleProvider }
    );
  • m

    millions-judge-24978

    06/28/2019, 4:23 PM
    Has anyone attempted to use https://github.com/346/pulumi-spotinst? I get a
    404
    when trying to install the resource plugin.
    w
    • 2
    • 2
  • s

    swift-painter-31084

    06/28/2019, 6:08 PM
    I was try to run static site example this morning and ran into this error when running
    pulumi up
    https://github.com/pulumi/examples/tree/master/aws-ts-static-website
    -.xml
    g
    b
    • 3
    • 6
  • m

    millions-judge-24978

    06/28/2019, 6:27 PM
    Any ETA when https://github.com/pulumi/pulumi-awsx/pull/332 might see a release? Or pointers on how to depend on `master`'s latest commit? The templating makes it difficult.
    w
    • 2
    • 2
  • b

    boundless-monkey-50243

    06/28/2019, 8:30 PM
    I've got an
    Array<pulumi.Output<T>>
    . Has anyone got a sneaky way (probably a reducer or something?) to turn that into a
    pulumi.Output<Array<T>>
    ?
    t
    • 2
    • 2
  • m

    millions-judge-24978

    06/28/2019, 9:25 PM
    I am having the common issue of duplicate resource URN's from helm charts. I'm deploying the same chart (
    stable/metrics-server
    ) into two clusters in a single stack. I tried using the new
    resourcePrefix
    option from https://github.com/pulumi/pulumi-kubernetes/pull/599. However, I believe this only affects the
    releaseName
    , indirectly affecting the URN. Some helm chart resources, i.e.
    APIService
    , do not use the
    releaseName
    as they must have very specific `metadata.name`s, like
    <http://v1beta1.metrics.k8s.io|v1beta1.metrics.k8s.io>
    . As a result, this ends up with a collision still occurring.
    g
    • 2
    • 2
  • d

    damp-pillow-67781

    06/28/2019, 11:07 PM
    Question: I'm trying to deploy a
    Servicemonitor
    to my EKS cluster into a specific namespace, but however I tried, it still installs into default namespace. Any idea on how to deploy not in default namespace? Here is the code I have:
    export const postgresServiceMonitorCRD = new k8s.apiextensions.CustomResource("postgres-servicemonitor", {
        apiVersion: "<http://monitoring.coreos.com/v1|monitoring.coreos.com/v1>",
        kind: "ServiceMonitor",
        namespace: namespaceName,
        transformations: [addMonitoringNamespace],
        metadata: {
            labels: {
                app: "prometheus-postgres-exporter-servicemonitor",
                release: "prometheus-operator",
            },
            name: "postgres-servicemonitor",
        },
        spec: {
            namespaceSelector: {
                any: true,
            },
            endpoints: [{
                port: "http",
                interval: "30s",
            },],
            selector: {
                matchLabels: {
                    app: "prometheus-postgres-exporter",
                    release: "postgres-exporter",
                },
            },
        },
    });
    m
    • 2
    • 3
  • i

    incalculable-diamond-5088

    06/29/2019, 12:35 PM
    Can I add an annotation to an existing namespace (kube-system) with pulumi? For example I want to add an annotation for
    kiam
    to allow assuming roles for pods in this namespace
    g
    • 2
    • 1
  • t

    thankful-lamp-48382

    06/29/2019, 1:30 PM
    const dnsRecord = new cloudflare.Record('my-dns-record', {
         name: 'my-dns-record-game-server',
         domain: zone,
         value: droplet.ipv4Address,
         type: 'A',
         ttl: 300
    }, {dependsOn: droplet})
  • t

    thankful-lamp-48382

    06/29/2019, 1:30 PM
    Gives me this:
    error: Plan apply failed: Error finding zone "<http://whack.io|whack.io>": ListZonesContext command failed: error from makeRequest: HTTP status 400: content "{\"success\":false,\"errors\":[{\"code\":6003,\"message\":\"Invalid request headers\",\"error_chain\":[{\"code\":6103,\"message\":\"Invalid format for X-Auth-Key header\"}]}],\"messages\":[],\"result\":null}"
  • t

    thankful-lamp-48382

    06/29/2019, 1:31 PM
    😞 Anyone has maybe some suggestion if I do something wrong? Or maybe there is some bug within pulumi/cloudflare package?
  • t

    thankful-lamp-48382

    06/29/2019, 1:32 PM
    I tried as zone both name (it is 'whack.io' here) or zone ID from cloudflare
  • t

    thankful-lamp-48382

    06/29/2019, 1:45 PM
    Ok, it was my fault! I used 'Origin CA Key' instead of 'Global API Key' from CloudFlare site 🤦‍♂️
  • b

    boundless-monkey-50243

    07/01/2019, 3:48 AM
    Is there a way to force the S3 backend to set
    s3:x-amz-acl
    to
    bucket-owner-full-control
    ?
  • c

    crooked-jordan-34725

    07/01/2019, 9:09 AM
    how can I create policies and policy attachments dynamically? I’m trying to use
    .apply
    on resources to create a policy that will need their ARNs, but apparently that’s not allowed
    b
    • 2
    • 2
  • b

    billions-lock-80282

    07/01/2019, 12:56 PM
    Hello, I can't see an autorepair property for the default node pool in a GKE cluster. Its only defined as part of nodepool property under management which does not include the default node pool.
    c
    • 2
    • 2
  • q

    quaint-queen-45003

    07/01/2019, 5:44 PM
    hello - i'm having some troubles with
    getObject
    and JSON encoded strings. The error is
    Property 'getObject' does not exist on type 'string'.ts(2339)
    . Any suggestions on this? I'll leave my code sample in a thread
    l
    • 2
    • 46
Powered by Linen
Title
q

quaint-queen-45003

07/01/2019, 5:44 PM
hello - i'm having some troubles with
getObject
and JSON encoded strings. The error is
Property 'getObject' does not exist on type 'string'.ts(2339)
. Any suggestions on this? I'll leave my code sample in a thread
export let testConfig = config.get("testConfig") || "\"{testConfig\": \"test\"}";
let getConfig = testConfig.getObject(testConfig);
l

lemon-spoon-91807

07/01/2019, 6:23 PM
so, question: i'm unfamiliar with 'getObject' (and i can't find any docs on it).
What are you expecting to have happen there?
oh... you were trying to use: https://github.com/pulumi/pulumi/blob/504478c64109864345f6bec4e8e6de5d59eb0d1c/sdk/nodejs/config.ts#L185
however, you called .getObject on a string.
what you want to do is
config.getObject
not
testConfig.getObject
.
Note: typescript will def help you out here 🙂
q

quaint-queen-45003

07/01/2019, 6:40 PM
hmm so it actually gets a bit more complicated than that
so in my
config.ts
i've got
let newrelicConfig = new pulumi.Config("newrelic");
export let newrelicAlertChannels = newrelicConfig.get("alertChannels") || "{\"alertChannels\":[{\"name\":\"slack\"}, {\"name\":\"pagerduty\"}}
im then importing
config.ts
into a new file
where i'm trying to do this
import * as config from "../config";
import { AlertChannelArgs } from "@pulumi/newrelic";

export interface NewRelicAlertChannel {
    name: string,
    type: string,
    configuration: AlertChannelArgs,
}
export const newrelicAlertChannels = config.newrelicConfig.getObject<Array<NewRelicAlertChannel>>("alertChannels");
l

lemon-spoon-91807

07/01/2019, 6:45 PM
Ok 🙂
q

quaint-queen-45003

07/01/2019, 6:57 PM
or is there any easy why to use an array of values from yaml with pulumi config files?
l

lemon-spoon-91807

07/01/2019, 6:57 PM
so all .getObject does is read out the string value, and then call JSON.parse on it
what sort of error are you getting with the above?
q

quaint-queen-45003

07/01/2019, 6:58 PM
Property 'getObject' does not exist on type 'string'.ts
when i set the json encoded string as default within config.ts
l

lemon-spoon-91807

07/01/2019, 6:58 PM
can you link me to your code?
it looks like you're simply calling .getObject on a string, not on hte real config object.
but it's hard to tell given what i can see so far.
q

quaint-queen-45003

07/01/2019, 6:59 PM
sec im trying to piece together a code sample while in a meeting. i'll grab my code shortly when i get back to my desk
l

lemon-spoon-91807

07/01/2019, 7:00 PM
sounds good!
q

quaint-queen-45003

07/01/2019, 7:06 PM
so here's what i have based on previous suggestions
in
config.ts
export let newrelicAlertChannels =  newrelicConfig.get("alertChannels") || "\"{alertChannels\": [{\"name\":\"slack\"}, {\"name\":\"pagerduty\"}]}";
l

lemon-spoon-91807

07/01/2019, 7:07 PM
ok. so that's just exporting a string.
q

quaint-queen-45003

07/01/2019, 7:07 PM
yup then in a different file
import { newrelicAlertChannels } from "../config";

export interface NewRelicAlertChannel {
    name: string,
    type: string,
    configuration: AlertChannelArgs,
}
 
export const alertingChannels= newrelicAlertChannels.getObject<Array<NewRelicAlertChannel>>("alertChannels");
l

lemon-spoon-91807

07/01/2019, 7:08 PM
right. you're importing a string, and callin .getObject on it 🙂
q

quaint-queen-45003

07/01/2019, 7:08 PM
and the error is
'getObject' does not exist on type 'string'.ts
l

lemon-spoon-91807

07/01/2019, 7:08 PM
one way you could address this (not necessarily teh best way)is to simply do this:
export const alertingChannels = JSON.parse(newrelicAlertChannels)
note: the issue you're runnign into above is not really a pulumi issue 🙂 it's something that would't work in JS at all. it's equivalent to:
file1.js
export let foo = "[1, 2, 3]";

file2.js
import foo from "file1";
let bar = foo.getObject("x");
does that make sense? 🙂
q

quaint-queen-45003

07/01/2019, 7:12 PM
ya it makes sense. i guess i'm confused why
getObject
works when pulling same string from config files
l

lemon-spoon-91807

07/01/2019, 7:13 PM
because you're calling it on a
pulumi.Config
object
i.e.
let newrelicConfig = new pulumi.Config("newrelic");
export let newrelicAlertChannels = newrelicConfig.get("alertChannels")
q

quaint-queen-45003

07/01/2019, 7:13 PM
bah i see
thanks 🙂
l

lemon-spoon-91807

07/01/2019, 7:13 PM
in this case,
.get
(or
.getObject
) is being called on a Config object, not a string
great! 🙂
q

quaint-queen-45003

07/01/2019, 7:25 PM
Thanks for the help. Im new to JS and it still bites me sometimes 🙂
l

lemon-spoon-91807

07/01/2019, 7:26 PM
absolutely! 🙂
i recommend TypeScript 😄
it helps a lot for these types of things
View count: 1