Skip to content

Commit

Permalink
Hack example to remove implicit node10 usage by the CDK
Browse files Browse the repository at this point in the history
  • Loading branch information
plumdog committed Nov 25, 2021
1 parent d21e662 commit 060e837
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions example/sops-example/lib/sops-example-stack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as cdk from '@aws-cdk/core';
import * as secretsmanager from '@aws-cdk/aws-secretsmanager';
import * as lambda from '@aws-cdk/aws-lambda';
import * as customResource from '@aws-cdk/custom-resources';

import { SopsSecretsManager } from './sops-secretsmanager-cdk-dev';

Expand All @@ -22,6 +24,15 @@ export class SopsExampleStack extends cdk.Stack {
},
});

// This section hacks the CDK's utility lambda to use Node 12,
// which uses Node 10 in cdk <1.94.0. This is no longer
// deployable as of July 30, 2021.
const providerWrapper = cdk.Stack.of(this).node.findChild('com.isotoma.cdk.custom-resources.sops-secrets-manager') as any;
const provider = providerWrapper.provider as customResource.Provider
const lambdaFn = provider.node.findChild('framework-onEvent') as unknown as lambda.Function;
const cfnLambdaFn = lambdaFn.node.defaultChild as lambda.CfnFunction;
cfnLambdaFn.addPropertyOverride('Runtime', lambda.Runtime.NODEJS_12_X.toString());

new cdk.CfnOutput(this, 'TestSecretArn', {
value: secret.secretArn,
});
Expand Down

0 comments on commit 060e837

Please sign in to comment.