From f25fd89ce752b8c5cafecd10cc57981da6b62bec Mon Sep 17 00:00:00 2001 From: Kaizen Conroy Date: Fri, 28 Oct 2022 12:44:07 -0400 Subject: [PATCH] fix(stepfunctions-tasks): athenaStartQueryExecution task generates invalid s3 arn --- .../lib/athena/start-query-execution.ts | 4 ++++ .../test/athena/start-query-execution.test.ts | 10 +--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts index 9918535134c67..0973734194573 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts @@ -109,6 +109,10 @@ export class AthenaStartQueryExecution extends sfn.TaskStateBase { resources: [ this.props.resultConfiguration?.outputLocation?.bucketName ? cdk.Stack.of(this).formatArn({ + // S3 Bucket names are globally unique in a partition, + // and so their ARNs have empty region and account components + region: '', + account: '', service: 's3', resource: this.props.resultConfiguration?.outputLocation?.bucketName, resourceName: this.props.resultConfiguration?.outputLocation?.objectKey, diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts index 6b3c24b62a045..5efe5525e9a99 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts @@ -216,15 +216,7 @@ describe('Start Query Execution', () => { { Ref: 'AWS::Partition', }, - ':s3:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':query-results-bucket/folder', + ':s3:::query-results-bucket/folder', ], ], },