• m

    magnificent-lifeguard-15082

    8 months ago
    ec2.Vpc.getSubnets
    returns a
    Promise<ec2.Subnet[]>
    as opposed to an
    Output<ec2.Subnet>[]
    . Is this safe to use as an arg (Input) to a subsequent resource where I need to provide a subnet id?
    m
    b
    +2
    14 replies
    Copy to Clipboard
  • p

    purple-megabyte-83002

    8 months ago
    hello I cannot resolve path, the path is well registered ??
    cwd /Users/john/Desktop/nxapp/apps/app-web/src-infra
        {
          target: 'es6',
          module: 'commonjs',
          moduleResolution: 'node',
          sourceMap: 'true',
          baseUrl: '../../../',
          paths: {
            '@app/infra': [ 'libs/infra/src/index.ts' ],
          },
          traceResolution: true
        }
     
        error: Running program '/Users/john/Desktop/nxapp/apps/app-web/src-infra/main.ts' failed with an unhandled exception:
        Error: Cannot find module '@app/infra'
        Require stack:
        - /Users/john/Desktop/nxapp/apps/app-web/src-infra/main.ts
        - /Users/john/Desktop/nxapp/node_modules/@pulumi/pulumi/cmd/run/run.js
        - /Users/john/Desktop/nxapp/node_modules/@pulumi/pulumi/cmd/run/index.js
            at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
            at Function.Module._load (node:internal/modules/cjs/loader:778:27)
            at Module.require (node:internal/modules/cjs/loader:1005:19)
            at require (node:internal/modules/cjs/helpers:102:18)
            at Object.<anonymous> (/Users/john/Desktop/nxapp/apps/app-web/src-infra/main.ts:1:1)
            at Module._compile (node:internal/modules/cjs/loader:1101:14)
            at Module.m._compile (/Users/john/Desktop/nxapp/node_modules/@pulumi/pulumi/node_modules/ts-node/src/index.ts:439:23)
            at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
            at Object.require.extensions.<computed> [as .ts] (/Users/john/Desktop/nxapp/node_modules/@pulumi/pulumi/node_modules/ts-node/src/index.ts:442:12)
            at Module.load (node:internal/modules/cjs/loader:981:32)
    p
    b
    8 replies
    Copy to Clipboard
  • g

    great-sunset-355

    8 months ago
    Hello, I'm trying to define a cloudwatch alarm and I'm getting TS error
    TS2322: Type 'Output<string | undefined>' is not assignable to type 'Input<string>'
    Because
    dimmensions
    is defined as
    /**
         * The dimensions for this metric.  For the list of available dimensions see the AWS documentation [here](<http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html>).
         */
        dimensions?: pulumi.Input<{
            [key: string]: pulumi.Input<string>;
        }>;
    Therefore I cannot use like this:
    new aws.cloudwatch.MetricAlarm(
          this.rcName('CpuHigh'),
          {
           ...
            dimensions: {
              ClusterName: this.cluster.clusterName!,
              ServiceName: this.service.name
            }
    
          }
        )
    I noticed a similar issue here: https://github.com/pulumi/pulumi-aws/pull/414 Is there any workaround for that?
    g
    b
    5 replies
    Copy to Clipboard
  • m

    magnificent-lifeguard-15082

    8 months ago
    Is there a utility function like the following in the available typescript api?
    pulumi.json.stringify = (obj: JsonValueWithPotentialOutputsToJsonValue) => Output<string>
    The return value here is an Output to a json string where the Output has collected all dependencies discovered while walking the passed object (JsonValueWithOutputs) Edit: just use
    pulumi.output(obj).apply(uObj => JSON.stringify(uObj))
    as output() deeply unwrapps 🎉 thanks pulumi team (lots of complexity is trivialised in the input/output api for us!)
    m
    4 replies
    Copy to Clipboard
  • a

    acoustic-room-2113

    8 months ago
    Hey y'all. Is it possible to try to see if a stack exists when using the S3 backend, prior to attempting to reference it or some way to allow referencing a non-existent stack to fail gracefully? This is what I'm trying currently and it's failing in preview.
    let kmsPolicy: aws.iam.Policy;
    try {
      const vaultStack = new pulumi.StackReference(`vault-${env}`);
      const vaultKey = vaultStack.getOutput(
        "vaultKey"
      ) as pulumi.Output<aws.kms.Key>;
    
      if (vaultKey != undefined && vaultKey != null) {
        kmsPolicy = new aws.iam.Policy("vaultKMSUnsealPolicy", {
          name: `VaultKMSUnsealKeyAccess-${env}`,
          description: "Allow access to Vault Unseal Key",
          policy: vaultKey.apply((key) =>
            JSON.stringify({
              Version: "2012-10-17",
              Statement: [
                {
                  Sid: "VaultKMSUnseal",
                  Effect: "Allow",
                  Action: ["kms:Encrypt", "kms:Decrypt", "kms:DescribeKey"],
                  Resource: key.arn,
                },
              ],
            })
          ),
        });
      }
    } catch (e) {
      console.log(e);
    }
    a
    l
    10 replies
    Copy to Clipboard
  • a

    acoustic-room-2113

    8 months ago
    More broadly speaking, I've noticed that try/catch hasn't worked for the things I've tried under pulumi
    a
    1 replies
    Copy to Clipboard
  • s

    sparse-florist-83224

    8 months ago
    Maybe I'm missing something obvious, but if I have a resource that starts a Docker container, then a resource that takes an action on that Docker container (in my case, starting Consul and then connecting to Consul), and then if I kill the Consul container, refresh doesn't work. I think I need to refresh to let Pulumi know that the container is down (since just running up doesn't restart it). But the refresh fails because my second resource attempts to connect to Consul (which is down) and fails. Thus, I can't refresh and up doesn't bring me back into compliance.
    s
    1 replies
    Copy to Clipboard