From 34758840e18d2c4436ee384ba673f77acce58209 Mon Sep 17 00:00:00 2001 From: watany <76135106+watany-dev@users.noreply.github.com> Date: Tue, 15 Oct 2024 09:36:17 +0000 Subject: [PATCH] tested --- .../aws-cloudfront-origins/lib/function-url-origin.ts | 2 +- .../test/function-url-origin.test.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk-lib/aws-cloudfront-origins/lib/function-url-origin.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/function-url-origin.ts index 436873e7ada61..e4e7ad5488fb9 100644 --- a/packages/aws-cdk-lib/aws-cloudfront-origins/lib/function-url-origin.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/function-url-origin.ts @@ -120,7 +120,7 @@ class FunctionUrlOriginWithOAC extends cloudfront.OriginBase { if (!this.isCheckAuthType()) { cdk.Annotations.of(scope).addWarning( - 'FunctionUrlOriginWithOAC: When the origin access control signing method is SIGV4_ALWAYS, it is recommended to set the authType of the Function URL to AWS_IAM.' + 'FunctionUrlOriginWithOAC: When the origin access control signing method is SIGV4_ALWAYS, it is recommended to set the authType of the Function URL to AWS_IAM.', ); } diff --git a/packages/aws-cdk-lib/aws-cloudfront-origins/test/function-url-origin.test.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/test/function-url-origin.test.ts index 6078c90e614dc..efeb54e1722ba 100644 --- a/packages/aws-cdk-lib/aws-cloudfront-origins/test/function-url-origin.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/test/function-url-origin.test.ts @@ -1,4 +1,4 @@ -import { Template, Match } from '../../assertions'; +import { Annotations, Template, Match } from '../../assertions'; import * as cloudfront from '../../aws-cloudfront'; import * as lambda from '../../aws-lambda'; import { Stack } from '../../core'; @@ -162,6 +162,11 @@ describe('FunctionUrlOriginAccessControl', () => { }, }); + // Check that the warning is added + Annotations.fromStack(stack).hasWarning('*', + 'FunctionUrlOriginWithOAC: When the origin access control signing method is SIGV4_ALWAYS, it is recommended to set the authType of the Function URL to AWS_IAM.', + ); + const template = Template.fromStack(stack); template.hasResourceProperties('AWS::CloudFront::Distribution', {