diff --git a/libs/pulumi-lambda/src/lib/lambda-function.ts b/libs/pulumi-lambda/src/lib/lambda-function.ts index c8b1b73..5e6e4cb 100644 --- a/libs/pulumi-lambda/src/lib/lambda-function.ts +++ b/libs/pulumi-lambda/src/lib/lambda-function.ts @@ -41,35 +41,35 @@ export class LambdaFunction extends pulumi.ComponentResource { }, opts?: | (pulumi.ComponentResourceOptions & { - /** - * Some versions of pulumi and/or aws-sdk are unable to delete log groups D:< - * This provides a way to alias them, so they don't need to be deleted & - * recreated. More info: - * https://www.pulumi.com/docs/intro/concepts/resources/#aliases - */ - logGroupAliases?: pulumi.ComponentResourceOptions['aliases'] - - /** - * Allow an existing aws.iam.Role resource to be migrated into this module, - * without module without being deleted & recreated. More info: - * https://www.pulumi.com/docs/intro/concepts/resources/#aliases - */ - executionRoleAliases?: pulumi.ComponentResourceOptions['aliases'] - - /** - * Allow an existing aws.iam.RolePolicyAttachment resource to be migrated - * into this module without being deleted & recreated. More info: - * https://www.pulumi.com/docs/intro/concepts/resources/#aliases - */ - rolePolicyAttachmentAliases?: pulumi.ComponentResourceOptions['aliases'] - - /** - * Allow an existing aws.lambda.Function resource to be migrated - * into this module without being deleted & recreated. More info: - * https://www.pulumi.com/docs/intro/concepts/resources/#aliases - */ - functionAliases?: pulumi.ComponentResourceOptions['aliases'] - }) + /** + * Some versions of pulumi and/or aws-sdk are unable to delete log groups D:< + * This provides a way to alias them, so they don't need to be deleted & + * recreated. More info: + * https://www.pulumi.com/docs/intro/concepts/resources/#aliases + */ + logGroupAliases?: pulumi.ComponentResourceOptions['aliases'] + + /** + * Allow an existing aws.iam.Role resource to be migrated into this module, + * without module without being deleted & recreated. More info: + * https://www.pulumi.com/docs/intro/concepts/resources/#aliases + */ + executionRoleAliases?: pulumi.ComponentResourceOptions['aliases'] + + /** + * Allow an existing aws.iam.RolePolicyAttachment resource to be migrated + * into this module without being deleted & recreated. More info: + * https://www.pulumi.com/docs/intro/concepts/resources/#aliases + */ + rolePolicyAttachmentAliases?: pulumi.ComponentResourceOptions['aliases'] + + /** + * Allow an existing aws.lambda.Function resource to be migrated + * into this module without being deleted & recreated. More info: + * https://www.pulumi.com/docs/intro/concepts/resources/#aliases + */ + functionAliases?: pulumi.ComponentResourceOptions['aliases'] + }) | undefined, ) { super('wanews:lambda', name, {}, opts) @@ -111,47 +111,47 @@ export class LambdaFunction extends pulumi.ComponentResource { this.executionRole = args.executionRoleName ? pulumi - .output(args.executionRoleName) - .apply((role) => - aws.iam.getRole( - { name: role }, - { - parent: this, - async: true, - }, - ), - ) - .apply((result) => - aws.iam.Role.get(result.name, result.id, undefined, { - parent: this, - }), - ) + .output(args.executionRoleName) + .apply((role) => + aws.iam.getRole( + { name: role }, + { + parent: this, + async: true, + }, + ), + ) + .apply((result) => + aws.iam.Role.get(result.name, result.id, undefined, { + parent: this, + }), + ) : args.executionRole - ? pulumi.output(args.executionRole) - : pulumi.output( - new aws.iam.Role( - roleName, - { - assumeRolePolicy: { - Version: '2012-10-17', - Statement: [ - { - Action: 'sts:AssumeRole', - Principal: { - Service: 'lambda.amazonaws.com', - }, - Effect: 'Allow', - }, - ], - }, - tags: args.getTags(name), - }, - { - parent: this, - aliases: opts?.executionRoleAliases, - }, - ), - ) + ? pulumi.output(args.executionRole) + : pulumi.output( + new aws.iam.Role( + roleName, + { + assumeRolePolicy: { + Version: '2012-10-17', + Statement: [ + { + Action: 'sts:AssumeRole', + Principal: { + Service: 'lambda.amazonaws.com', + }, + Effect: 'Allow', + }, + ], + }, + tags: args.getTags(name), + }, + { + parent: this, + aliases: opts?.executionRoleAliases, + }, + ), + ) new aws.iam.RolePolicyAttachment( `${name}-attach-execution-policy`, @@ -166,7 +166,7 @@ export class LambdaFunction extends pulumi.ComponentResource { name, { name, - runtime: 'nodejs14.x', + runtime: 'nodejs16.x', role: this.executionRole.arn.apply(async (arn) => { if (args.delayLambdaDeployment) { console.log('waiting for IAM changes to propagate') diff --git a/package.json b/package.json index 246d420..7280c26 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@nrwl/jest": "13.10.2", "@nrwl/linter": "13.10.2", "@nrwl/workspace": "13.10.2", - "@pulumi/aws": "^5.1.3", + "@pulumi/aws": "^5.43.0", "@pulumi/pagerduty": "^3.4.0", "@pulumi/pulumi": "^3.29.1", "@pulumi/random": "^4.4.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3502c8f..8209abd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,8 +42,8 @@ importers: specifier: 13.10.2 version: 13.10.2(eslint@8.13.0)(prettier@2.6.2)(ts-node@10.7.0)(typescript@4.6.3) '@pulumi/aws': - specifier: ^5.1.3 - version: 5.1.3 + specifier: ^5.43.0 + version: 5.43.0 '@pulumi/pagerduty': specifier: ^3.4.0 version: 3.4.0 @@ -2885,6 +2885,19 @@ packages: mime: 2.6.0 read-package-tree: 5.3.1 resolve: 1.22.0 + dev: false + + /@pulumi/aws@5.43.0: + resolution: {integrity: sha512-ZWI+QvEaFy27wUW8j8EVadgvl6u3926AAgpghflSPxF/9mG5XoDy0rqkRZOgO13ZJinC1qkQDzoMz0ACgmwTiw==} + requiresBuild: true + dependencies: + '@pulumi/pulumi': 3.29.1 + aws-sdk: 2.1441.0 + builtin-modules: 3.0.0 + mime: 2.6.0 + read-package-tree: 5.3.1 + resolve: 1.22.0 + dev: true /@pulumi/pagerduty@3.4.0: resolution: {integrity: sha512-ZCVTh2iRQq4a55y3DuN0d5I7C4KuK5AxclHCelEZhRpuoSwDDhx4uvmRyikSaIlpEAu0hGeMznktI/32e61L1Q==}