limited-rainbow-51650
04/16/2020, 12:42 PM"module": "ES2015"
, then I get the error:
/Users/ringods/Projects/cumundi/blueprints/libraries/packages/network/lib/index.js:1
import * as pulumi from "@pulumi/pulumi";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1070:16)
at Module._compile (internal/modules/cjs/loader.js:1120:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
which points me to this article: https://stackoverflow.com/questions/58384179/syntaxerror-cannot-use-import-statement-outside-a-module
The advice is to set "type": "module"
in package.json
. After doing that, yet another error on Node 12.16.2:
Error: Not supported
at requireOrImport (/Users/ringods/Projects/cumundi/blueprints/libraries/node_modules/mocha/lib/esm-utils.js:18:25)
at Object.exports.loadFilesAsync (/Users/ringods/Projects/cumundi/blueprints/libraries/node_modules/mocha/lib/esm-utils.js:28:26)
at Mocha.loadFilesAsync (/Users/ringods/Projects/cumundi/blueprints/libraries/node_modules/mocha/lib/mocha.js:351:19)
at singleRun (/Users/ringods/Projects/cumundi/blueprints/libraries/node_modules/mocha/lib/cli/run-helpers.js:107:15)
*sigh*…limited-rainbow-51650
04/16/2020, 2:26 PMThis SDK uses Node.js and we support the Active LTS and Current releases, as defined by this table.and the `package.json`:
"engines": {
"node": ">=8.13.0 || >=10.10.0"
}
Vrsion 8.13+ should be removed. Your tsconfig.json
says it transpiles to es2016
, which 8.13 definitely does not support everything off. See https://node.green/limited-rainbow-51650
04/16/2020, 2:42 PMrough-tomato-98795
04/23/2020, 6:53 AMacceptable-army-69872
04/23/2020, 3:06 PMerror TS2488: Type 'Promise<Subnet[]>' must have a '[Symbol.iterator]()' method that returns an iterator.
the code is looping thru a list of awsx vpcs that should have a vpc peer, then looping thru the subnets to create routes.famous-sugar-52038
04/24/2020, 3:53 PMpulumi new
.fancy-jelly-61092
04/27/2020, 1:32 PMpulumi.dynamic.ResourceProvider
). I need credentials that will come from Config. I'm struggling to get config working in the dynamic provider though.
I could pass the credentials in as arguments, but that forces every user of the resource to set them. Which I want to avoid as the values should be ambient from config (like the built in ones)
I've tried getting the secrets form outside the closure, but that fails with Error: Secret outputs cannot be captured by a closure
, and trying inside I just get Error: undefined
on the line that tries to requireSecret.
What am I doing wrong? Can pulumi.Config
not be used within a ResourceProvider
?
Code snippet showing config _outside_:
const config = new pulumi.Config('activeDirectoryAdmin');
const usernameSecret = config.requireSecret('username');
const passwordSecret = config.requireSecret('password');
async function runSql(a: pulumi.Unwrap<SqlCommandArgs>, command: string): Promise<never> {
return new Promise((resolve, reject) => {
pulumi.all([usernameSecret, passwordSecret]).apply(([username, password]: [string, string]) => {
const sqlConnection = new tedious.Connection({
Code snippet showing config _inside_:
async function runSql(a: pulumi.Unwrap<SqlCommandArgs>, command: string): Promise<never> {
return new Promise((resolve, reject) => {
const config = new pulumi.Config('activeDirectoryAdmin');
const usernameSecret = config.requireSecret('username');
const passwordSecret = config.requireSecret('password');
acceptable-stone-35112
04/28/2020, 3:28 PMgorgeous-animal-95046
04/28/2020, 8:31 PMaws.getCallerIdentity
now returns a promise. the problem i’m having is i can’t pass the account id returned from that into a aws.iam.getPolicyDocument
because it’s inputs are all string
. Specifically this is for a principal identifier on an assume role policy. My old code used to be `identifiers: [arn:aws:iam::${accountNumber}:role/terraform-eks-k8s-node
]`lively-oil-7382
04/28/2020, 9:07 PMlively-oil-7382
04/28/2020, 9:07 PMlively-oil-7382
04/28/2020, 9:07 PMdamp-jelly-5493
04/30/2020, 8:08 AMpulumi.export('public_ip', server.public_ip)
.
For <reasons>
, I could do with doing a similar sort of thing in TypeScript - is there any way of getting TS to create outputs with a pulumi method rather than the export const public_ip = server.public_up
?rhythmic-country-29988
04/30/2020, 8:11 AMimport * as aws from '@pulumi/aws';
import * as pulumi from '@pulumi/pulumi';
import { v4 as uuid } from 'uuid';
import { CognitoUserPoolTriggerEvent } from 'aws-lambda';
const name = 'mylambda';
const partitionRole = new aws.iam.Role(
`${name}-lambda-role`, {
assumeRolePolicy: JSON.stringify({
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "<http://lambda.amazonaws.com|lambda.amazonaws.com>",
},
"Effect": "Allow",
"Sid": "",
},
],
})
},
);
const attachment = new aws.iam.RolePolicyAttachment(
`${name}-lambda-role-attachment`, {
role: partitionRole,
policyArn: aws.iam.ManagedPolicies.AWSLambdaFullAccess,
},
{ dependsOn: [ partitionRole ] },
);
const preTokenLambda = new aws.lambda.CallbackFunction<CognitoUserPoolTriggerEvent, CognitoUserPoolTriggerEvent>(
name, {
name: `${name}-lambda-${uuid()}`,
description: "lambda.",
role: partitionRole,
runtime: aws.lambda.NodeJS12dXRuntime,
memorySize: 128,
timeout: 30,
reservedConcurrentExecutions: 50,
callback: async (event) => {
event.response.claimsOverrideDetails = {
claimsToAddOrOverride: {
role: 'member',
bla: 'yes',
},
};
return event;
},
},
{ dependsOn: [ partitionRole, attachment ] },
);
I am forcing the lambda to recreate including a uuid in its name. It uploads it correctly but then I consistently get a function already exist
error
+ aws:lambda:Function pool creating error: Error creating Lambda function: ResourceConflictException: Function already exist: pool-lambda-80a6da40-c917-41c9-90d8-7cef62a40dcc
any ideas?famous-bear-66383
04/30/2020, 12:22 PMgke cluster
, how to quickly upgrade it to Pulumi 2 ?
The following steps didn’t work out for me:
• delete node_modules directory and package-lock.json
• brew upgrade pulumi to install the new cli
• npm install @pulumi/pulumi@^2.0.0
• pulumi up
Error:
Previewing update (project1):
Type Name Plan Info
pulumi:pulumi:Stack project1 1 error
Diagnostics:
pulumi:pulumi:Stack (project1):
error: Running program '/Users/<user>/<company>/<project1>' failed with an unhandled exception:
Error: Could not locate the bindings file. Tried:
→ /Users/<user>/<company>/<project1>/node_modules/deasync/build/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/build/Debug/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/build/Release/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/out/Debug/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/Debug/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/out/Release/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/Release/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/build/default/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/compiled/14.0.0/darwin/x64/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/addon-build/release/install-root/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/addon-build/debug/install-root/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/addon-build/default/install-root/deasync.node
→ /Users/<user>/<company>/<project1>/node_modules/deasync/lib/binding/node-v83-darwin-x64/deasync.node
at bindings (/Users/<user>/<company>/<project1>/node_modules/bindings/bindings.js:126:9)
at Object.<anonymous> (/Users/<user>/<company>/<project1>/node_modules/deasync/index.js:30:31)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/<user>/<company>/<project1>/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/utils.js:16:17)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
Is there others to steps to make a successful migration ?numerous-plastic-88847
05/02/2020, 9:36 AMcool-processor-86981
05/05/2020, 3:28 PMpulumi up --diff
I get stuff like cloudfrontDistUrl: "<http://xxxxxxxx.cloudfront.net|xxxxxxxx.cloudfront.net>" => output<string>
. Is there a way to make that output<string>
show the real output?magnificent-accountant-19074
05/05/2020, 6:54 PMaws.lambda.Alias
how can I wire it up with API
? I was not able to find any documentation on this.breezy-butcher-78604
05/06/2020, 5:31 AMconst vpcStackRef = new pulumi.StackReference("main-vpc", { name: cfg.require("vpcStack") });
for (const routeTableId of vpcStackRef.requireOutput("privateRouteTableIds")) {
// create new aws.ec2.Route resource
}
limited-rainbow-51650
05/06/2020, 7:03 PMstring
. I would like to pass a full object. The problem I have is this: if the project is created in the same stack, I have a gcp.organizations.Project
instance, with Output
properties. If the project was already created in another stack, I look it up via getProject
and I am returned a Promise<GetProjectResult>
. The properties of a GetProjectResult
instance are the primitive types (not Output
). So I can’t substitute one for the other just because the resource is created in another stack. Any way around this?many-dress-88879
05/06/2020, 11:00 PMwooden-lighter-66320
05/06/2020, 11:51 PMwooden-lighter-66320
05/06/2020, 11:51 PMgreen-morning-1318
05/07/2020, 12:00 AMgreen-morning-1318
05/07/2020, 12:02 AMwooden-lighter-66320
05/07/2020, 12:15 AMwooden-lighter-66320
05/07/2020, 12:16 AMgreen-morning-1318
05/07/2020, 12:16 AMgreen-morning-1318
05/07/2020, 12:17 AMbreezy-butcher-78604
05/07/2020, 12:57 AMpulumi.aws
resources rather than composing things with pulumi.awsx
resources and/or other custom resources). The main reason being is because it then increases the learning curve for other developers to understand what that custom resource does and how it works. Most developers (as opposed to SREs or operations engineers) working on infrastructure code will only have a basic understanding of the cloud provider they're using so putting too much abstraction on top of the base resources they may know about makes it harder for them to learn and contribute.
if you don't work in a team then the second point is probably less important but I'd still recommend the first. This is just my personal opinion though and it seems to work for me.breezy-butcher-78604
05/07/2020, 12:57 AMpulumi.aws
resources rather than composing things with pulumi.awsx
resources and/or other custom resources). The main reason being is because it then increases the learning curve for other developers to understand what that custom resource does and how it works. Most developers (as opposed to SREs or operations engineers) working on infrastructure code will only have a basic understanding of the cloud provider they're using so putting too much abstraction on top of the base resources they may know about makes it harder for them to learn and contribute.
if you don't work in a team then the second point is probably less important but I'd still recommend the first. This is just my personal opinion though and it seems to work for me.