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

    colossal-easter-73659

    12/11/2020, 2:53 PM
    const region: aws.Region = <aws.Region>"us-east-1";
        const regionWest = aws.Region.USWest2;
        const providerEast = new aws.Provider(`provider-${region}`, {
            region: region,
            profile: "dev_account_work",
        });
        const providerWest = new aws.Provider(`provider-${regionWest}`, {
            region: regionWest,
            profile: "dev_account_work",
        });
        const existing = aws.lambda.Function.get(
            arnWest,
            arnWest,
            {},
            { provider: providerWest }
        );
        const endpoint = new awsx.apigateway.API(
            "test-api",
            {
                routes: [
                    // Serve a simple REST API on `GET /name` (using AWS Lambda)
                    {
                        path: "/source",
                        method: "GET",
                        eventHandler: existing,
                    },
                ],
                restApiArgs: {endpointConfiguration: { types: 'REGIONAL'}}
            },
            // { providers: [providerEast, providerWest] }
            {provider: providerEast}
        );
        // Export the public URL for the HTTP service
        exports.url = endpoint.url;
    }
  • c

    colossal-easter-73659

    12/13/2020, 5:31 PM
    i also tried this to no success. It seems to still auto-generate the lambda trigger Permission and fails bc of region no matter what. adding both providers to the gateway still deploys gateway to wrong region.
    Untitled
  • w

    worried-queen-62794

    12/16/2020, 11:27 AM
    Any idea why I am getting this error?
    Diagnostics:
      pulumi:pulumi:Stack (auth-prod):
        error: Running program '/Users/jason/source/tlayen-infrastructure/security/auth' failed with an unhandled exception:
        TypeError: Class constructor ComponentResource cannot be invoked without 'new'
            at new UserRole (/Users/jason/source/tlayen-infrastructure/modules/pulumix-aws/dist/index.js:77:28)
    I am calling `new`:
    const administratorUserRole = new UserRole("Administrator", {
        accountId: accountId
    }, opts);
    All my other ComponentResources work fine.
    b
    l
    • 3
    • 5
  • p

    prehistoric-nail-50687

    12/16/2020, 12:02 PM
    How can I read a PFX Certificate and pass it as input to a Certificate Resource? I do the following:
    const fs = require("fs");
    const certBinary = fs.readFileSync("./mycomp.com.pfx");
    
    const cert = new azure.appservice.Certificate("mycert", {
      name: "mycert",
      location: "switzerlandnorth",
      resourceGroupName: "my-rg",
      password: "xxxx",
      pfxBlob: certBinary,
    });
    But I get this error:
    azure:appservice:Certificate (mycert):
        error: azure:appservice/certificate:Certificate resource 'mycert' has a problem: pfx_blob must be a single value, not a map
    The certificate is fine, I can upload it without any issues via the azure portal by hand.
    • 1
    • 1
  • g

    green-country-86774

    12/17/2020, 1:52 AM
    Hi! Is it possible to to trigger an update on a resource if a dependency changes? For example:
    const basic1 = new BasicResource("basic1", { value: "value1" })
    const basic2 = new BasicResource("basic2", { value: "value2" }, { dependsOn: [basic1] })
    I'm working on a dynamic resource and I was hoping to be able to run an update on
    basic2
    when the value of
    basic1
    changes. The use case I'm trying to address is rebuilding a search engine index if a facet value changes.
    c
    • 2
    • 8
  • f

    future-oyster-5387

    12/21/2020, 3:35 PM
    I don't see a tutorial, and looking through the API Docs cannot find, how I can configure the logGroup retention policy when I use aws.cloudwatch.onSchedule to schedule a recurring aws.lambda.CallbackFunction. Does someone know how?
    g
    • 2
    • 2
  • f

    future-oyster-5387

    12/21/2020, 9:19 PM
    Is there a way, using awsx.apigateway.API, to add a default static route that serves the contents of /index.html? So that an SPA will be loaded when the route isn't an API call, and the response from the s3 bucket is 404? I cannot find the configuration, I think it needs to be added to the route config I have to the s3 static bucket:
    routes.push({
      method: 'ANY',
      path: '/',
      localPath: path.join(__dirname, '../', 'frontend', 'build'),
    })
    but I don't see any options for it.
  • b

    best-lifeguard-91445

    12/21/2020, 10:43 PM
    I'm getting a panic error when trying to preview my stack - any ideas?
    panic: interface conversion: interface {} is string, not int
        goroutine 1468 [running]:
        <http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.SerializeValueForHash(0xc0005e2f08|github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.SerializeValueForHash(0xc0005e2f08>, 0x54033c0, 0x6fa5e00, 0xc000d08f00)
            /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20200910230100-328eb4ff41df/helper/schema/serialize.go:24 +0x959
        <http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.SerializeResourceForHash(0xc0005e2f08|github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.SerializeResourceForHash(0xc0005e2f08>, 0x5a626e0, 0xc0022b6f00, 0xc000cdfd90)
            /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20200910230100-328eb4ff41df/helper/schema/serialize.go:115 +0x386
        <http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.HashResource.func1(0x5a626e0|github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.HashResource.func1(0x5a626e0>, 0xc0022b6f00, 0xc00228d510)
            /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20200910230100-328eb4ff41df/helper/schema/set.go:32 +0x6f
        <http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).hash(0xc00228d500|github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).hash(0xc00228d500>, 0x5a626e0, 0xc0022b6f00, 0xc00228d360, 0xc00228d540)
            /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20200910230100-328eb4ff41df/helper/schema/set.go:251 +0x44
        <http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).add(0xc00228d500|github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).add(0xc00228d500>, 0x5a626e0, 0xc0022b6f00, 0x0, 0x5a626e0, 0xc0022b6f00)
            /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20200910230100-328eb4ff41df/helper/schema/set.go:231 +0x8b
        <http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).Add(...)|github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).Add(...)>
    b
    g
    • 3
    • 12
  • w

    worried-queen-62794

    12/21/2020, 11:43 PM
    If I have a
    Output<boolean> | undefined
    and a function
    boolean => string | undefined
    I can apply that to get
    Output<string | undefined> | undefined
    . How can lift the inner
    undefined
    out so it just becomes ``Output<string> | undefined` ?
    l
    • 2
    • 25
  • e

    elegant-dress-88912

    12/23/2020, 11:27 AM
    Hello, I'm looking for a way to do a conditional output. Pseudocode below:
    if (config.createS3Bucket) {
      const s3Bucket = new ...
      export s3BucketName = s3Bucket.name
    }
    The thing is that typescript wants all `export`'s to be at the top level. What do I do?
    p
    • 2
    • 3
  • p

    proud-pizza-80589

    12/23/2020, 11:43 AM
    How do i get (with typescript) the gcp:zone from the config? config,get(‘gcp.zone’) adds the namespace of the project to it:
    Missing required configuration variable 'launchpad-cluster:gcp:zone'
    • 1
    • 1
  • q

    quiet-tomato-48326

    12/25/2020, 1:07 AM
    I’m getting a snapshot integrity failure:
    error: .pulumi/stacks/news.thewest.json: snapshot integrity failure; refusing to use it: resource urn:pulumi:news.thewest::news::swm:curation$swm:fargate-app$aws:ecs/service:Service::news-thewest-curation-app-service dependency urn:pulumi:news.thewest::news::swm:curation$swm:fargate-app$aws:ecs/taskDefinition:TaskDefinition::news-thewest-curation-app-task refers to missing resource
    Unfortunately, the .bak also has a snapshot integrity failure. How would you recover from this? I’m thinking it will require manually editing the state file. Any idea where to get started?
  • q

    quiet-tomato-48326

    12/25/2020, 1:30 AM
    All of the missing resources are TaskDefinitions. I’ve deleted the URNs from the
    dependencies
    sections of the affected resources, and the plan now wants to create the TaskDefinitions, and update the ECS services with the new task definitions. It looks like most of the task definitions are already deleted, but if there are any remaining, I’ll delete them manually.
  • g

    gorgeous-elephant-23271

    12/30/2020, 6:31 PM
    Hi there, I can't for the life of me find a code sample that sets a k8s image pull secret for an ACR registry, so that container pulls work
  • g

    gorgeous-elephant-23271

    12/30/2020, 6:31 PM
    I want to do this entirely in pulumi without using the
    --attach-acr
    az command
  • g

    gorgeous-elephant-23271

    12/30/2020, 6:33 PM
    I've made a base64 encoded json object with the ACR server as a key to an object with `username`/`password` being the service principal client id/secret
  • g

    gorgeous-elephant-23271

    12/30/2020, 6:33 PM
    but then I get an error:
    Secret "acr-secret" is invalid: data[.dockercfg]: Invalid value: "<secret contents redacted>": json: cannot unmarshal string into Go value of type map[string]interface {}
  • g

    gorgeous-elephant-23271

    12/30/2020, 6:33 PM
    here's the code: ``````
  • g

    gorgeous-elephant-23271

    12/30/2020, 6:34 PM
    const secretData = pulumi.all([acr.loginServer, servicePrincipal.id, password])
      .apply(([loginServer, servicePrincipal, servicePrincipalPassword]) => {
        return {
          [loginServer]: {
            username: servicePrincipal,
            password: servicePrincipalPassword
          }
        }
      })
    
    const encoded = encode(JSON.stringify(secretData))
  • g

    gorgeous-elephant-23271

    12/30/2020, 6:47 PM
    Aha, found something that might work here: https://www.westerndevs.com/kubernetes/kubernetes-my-journey-part-7a/, under the
    KUBERNETES SECRETS
    section
  • g

    gorgeous-elephant-23271

    12/30/2020, 6:47 PM
    would be a great helper method to include natively!
  • g

    gorgeous-elephant-23271

    12/30/2020, 7:20 PM
    That worked!
  • p

    proud-pizza-80589

    01/01/2021, 6:15 PM
    I’m trying to add tests to my pulumi code, in this case a CustomResource i’ve created. I have to use jest so the code is a bit different than the docs. My tests work and i can verify what i want to verify, but at the end it tries to log an unhandled rejection:
    unhandled rejection: CONTEXT(221): monitor.registerResourceOutputs(...)-initial
    Full test code and error here: https://gist.github.com/roderik/1ff8d4df9c76f13f7441f7e5c34cc7dd Any idea how i can fix this?
    • 1
    • 1
  • a

    agreeable-ram-97887

    01/01/2021, 11:26 PM
    Does anyone have a suggested pattern for structuring a large typescript pulumi project? I would like to avoid placing everything under a single "index.ts" file. Instead I would prefer to create a directory-tree to better organize the code which should all be invoked by the project's root index.ts. But I am unsure of how to do this cleanly, or if any examples of this can be found online?
    p
    p
    f
    • 4
    • 3
  • b

    bitter-dentist-28132

    01/06/2021, 5:55 PM
    anyone know if there are typescript types/interfaces for cert-manager's kubernetes bits?
    s
    • 2
    • 1
  • c

    colossal-monkey-98692

    01/07/2021, 7:41 PM
    Running a pulumi up is taking a VERY long time (> 1 minute) before it even starts working on the resources. I am becoming concerned as my stack is not even very big yet I plan on it getting much larger. Anything I should look at or debug?
    c
    f
    • 3
    • 16
  • f

    future-potato-71458

    01/07/2021, 8:01 PM
    How does one ignore changes in a map
    c
    • 2
    • 4
  • f

    future-potato-71458

    01/07/2021, 8:01 PM
    I tried
    "metadata.annotations['<http://run.googleapis.com/client-version|run.googleapis.com/client-version>']",
  • f

    future-potato-71458

    01/07/2021, 8:01 PM
    without success
  • p

    purple-beach-36424

    01/08/2021, 4:59 PM
    Hi I was wondering if anyone stumble on this kind of weird typing error. I have to explicitly cast
    Output
    to
    OutputInstance
    otherwise the language server complains
    protected service: k8s.core.v1.Service = ...;
    ...
    backend: {
        resource: {
            apiGroup: this.service.apiVersion as pulumi.OutputInstance<string>,
            kind: this.service.kind as pulumi.OutputInstance<string>,
            name: this.name,
        }
    } as inputs.networking.v1beta1.IngressBackend
    The odd thing is that from the typings,
    Output
    is an
    OutputInstance
    export declare type Output<T> = OutputInstance<T> & Lifted<T>;
    Not a major issue but I don’t really understand the subtlety of that 😅 🤷
Powered by Linen
Title
p

purple-beach-36424

01/08/2021, 4:59 PM
Hi I was wondering if anyone stumble on this kind of weird typing error. I have to explicitly cast
Output
to
OutputInstance
otherwise the language server complains
protected service: k8s.core.v1.Service = ...;
...
backend: {
    resource: {
        apiGroup: this.service.apiVersion as pulumi.OutputInstance<string>,
        kind: this.service.kind as pulumi.OutputInstance<string>,
        name: this.name,
    }
} as inputs.networking.v1beta1.IngressBackend
The odd thing is that from the typings,
Output
is an
OutputInstance
export declare type Output<T> = OutputInstance<T> & Lifted<T>;
Not a major issue but I don’t really understand the subtlety of that 😅 🤷
View count: 1