Skip to content

Commit f556fd1

Browse files
feat(lambda): allow propagating function tags to loggroup (#34556)
### Issue # (if applicable) same as #34473 Fixes an issue with test. This is resolved if you put the test above the metadata tests. Do not know the root cause. ``` FAIL aws-lambda/test/function.test.ts ● Test suite failed to run TypeError: this.isNative is not a function at Object.CallSiteToString [as toString] (../../node_modules/source-map-support/source-map-support.js:295:12) at Function.prepareStackTrace (../../node_modules/source-map-support/source-map-support.js:446:37) ``` Closes #<issue number here>. #17533 ### Reason for this change Refer README and issue. ### Description of changes Added a feature flag USE_CDK_MANAGED_LAMBDA_LOGGROUP Refer README section on ## Customizing Log Group Creation for more details ### Describe any new or updated permissions being added N/A ### Description of how you validated changes Unit and integ tests are added to this PR ### Checklist - [x ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 2d6a3bc commit f556fd1

File tree

417 files changed

+34106
-2414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

417 files changed

+34106
-2414
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.api-with-authorizer-and-proxy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import * as lambda from 'aws-cdk-lib/aws-lambda';
1010
* * `curl -i <CFN output PetsURL>` should return HTTP code 200
1111
*/
1212

13-
const app = new cdk.App();
13+
const app = new cdk.App({
14+
postCliContext: {
15+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
16+
},
17+
});
1418
const stack = new cdk.Stack(app, 'integtest-restapi-with-authorizer-and-proxy');
1519

1620
// create a cognito user pool

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import { STANDARD_NODEJS_RUNTIME } from '../../../config';
99
// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: deny' <url>?allow=yes` should return 403
1010
// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: allow' <url>?allow=yes` should return 200
1111

12-
const app = new App();
12+
const app = new App({
13+
postCliContext: {
14+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
15+
},
16+
});
1317
const stack = new Stack(app, 'RequestAuthorizerInteg');
1418

1519
const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ import { STANDARD_NODEJS_RUNTIME } from '../../../config';
1313
* * `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: allow' <url>` should return 200
1414
*/
1515

16-
const app = new App();
16+
const app = new App({
17+
postCliContext: {
18+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
19+
},
20+
});
1721
const stack = new Stack(app, 'TokenAuthorizerIAMRoleInteg');
1822

1923
const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests-alpha';
55
import { MockIntegration, PassthroughBehavior, RestApi, TokenAuthorizer, Cors } from 'aws-cdk-lib/aws-apigateway';
66
import { STANDARD_NODEJS_RUNTIME } from '../../../config';
77

8-
const app = new App();
8+
const app = new App({
9+
postCliContext: {
10+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
11+
},
12+
});
913
const stack = new Stack(app, 'TokenAuthorizerInteg');
1014

1115
const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors-allow-multiple-origins.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { App, Stack } from 'aws-cdk-lib';
44
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
55
import * as apigw from 'aws-cdk-lib/aws-apigateway';
66

7-
const app = new App();
7+
const app = new App({
8+
postCliContext: {
9+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
10+
},
11+
});
812
const stack = new Stack(app, 'stack-cors-allow-multiple-origins');
913

1014
const api = new apigw.RestApi(stack, 'cors-api-test', {

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ class TestStack extends Stack {
3030
}
3131
}
3232

33-
const app = new App();
33+
const app = new App({
34+
postCliContext: {
35+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
36+
},
37+
});
3438
const testCase = new TestStack(app, 'cors-twitch-test');
3539
new IntegTest(app, 'cors', {
3640
testCases: [testCase],

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ class LambdaApiIntegrationOptionsNonProxyIntegrationStack extends Stack {
3434
}
3535
}
3636

37-
const app = new App();
37+
const app = new App({
38+
postCliContext: {
39+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
40+
},
41+
});
3842
const testCase = new LambdaApiIntegrationOptionsNonProxyIntegrationStack(app);
3943
new IntegTest(app, 'lambda-non-proxy-integration', {
4044
testCases: [testCase],

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ class LateBoundDeploymentStageStack extends Stack {
2929
}
3030
}
3131

32-
const app = new App();
32+
const app = new App({
33+
postCliContext: {
34+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
35+
},
36+
});
3337
const testCase = new LateBoundDeploymentStageStack(app);
3438
new IntegTest(app, 'lambda-api-latebound-deploymentstage', {
3539
testCases: [testCase],

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ class LambdaApiIntegrationOptionsStack extends Stack {
3333
}
3434
}
3535

36-
const app = new App();
36+
const app = new App({
37+
postCliContext: {
38+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
39+
},
40+
});
3741
const testCase = new LambdaApiIntegrationOptionsStack(app);
3842
const integ = new IntegTest(app, 'lambda-integration', {
3943
testCases: [testCase],

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-default-apikey.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { LambdaIntegration, RestApi } from 'aws-cdk-lib/aws-apigateway';
44
import { App, Stack } from 'aws-cdk-lib';
55
import { STANDARD_NODEJS_RUNTIME } from '../../config';
66

7-
const app = new App();
7+
const app = new App({
8+
postCliContext: {
9+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
10+
},
11+
});
812

913
const stack = new Stack(app, 'aws-cdk-lambda-1');
1014

0 commit comments

Comments
 (0)