@@ -17,7 +17,6 @@ import * as kms from '@aws-cdk/aws-kms';
1717import * as s3 from '@aws-cdk/aws-s3' ;
1818import { RegionInfo } from '@aws-cdk/region-info' ;
1919import { EbsDefaultEncryption } from '@aws-accelerator/custom-resource-ec2-ebs-default-encryption' ;
20- import { S3CopyFiles } from '@aws-accelerator/custom-resource-s3-copy-files' ;
2120import { S3PublicAccessBlock } from '@aws-accelerator/custom-resource-s3-public-access-block' ;
2221import { Organizations } from '@aws-accelerator/custom-resource-organization' ;
2322import { AcceleratorConfig } from '@aws-accelerator/common-config/src' ;
@@ -191,7 +190,6 @@ function createCentralBucketCopy(props: DefaultsStep1Props) {
191190 */
192191function createCentralLogBucket ( props : DefaultsStep1Props ) {
193192 const { accountStacks, config } = props ;
194-
195193 const logAccountConfig = config [ 'global-options' ] [ 'central-log-services' ] ;
196194 const logAccountStack = accountStacks . getOrCreateAccountStack ( logAccountConfig . account ) ;
197195
@@ -200,6 +198,7 @@ function createCentralLogBucket(props: DefaultsStep1Props) {
200198 const anyAccountPrincipal = [ new iam . AnyPrincipal ( ) ] ;
201199 const logKey = createDefaultS3Key ( {
202200 accountStack : logAccountStack ,
201+ prefix : props . acceleratorPrefix ,
203202 } ) ;
204203
205204 const defaultLogRetention = config [ 'global-options' ] [ 'central-log-services' ] [ 's3-retention' ] ;
@@ -546,15 +545,15 @@ function createDefaultEncryptionKeys(props: DefaultsStep1Props): LogAccountDefau
546545 console . warn ( `Cannot find ${ accountStack } stack in ${ region } ` ) ;
547546 continue ;
548547 }
549- createKeyAndOutput ( accountStack , region , defaultEncryptionKeys ) ;
548+ createKeyAndOutput ( accountStack , region , defaultEncryptionKeys , props . acceleratorPrefix ) ;
550549 // If add-sns-topic is set true for the security account, create a default key in other regions there as well
551550 if ( centralSecurityServices [ 'add-sns-topics' ] ) {
552551 const accountStack = accountStacks . tryGetOrCreateAccountStack ( centralSecurityServices . account , region ) ;
553552 if ( ! accountStack ) {
554553 console . warn ( `Cannot find ${ accountStack } stack in ${ region } ` ) ;
555554 continue ;
556555 }
557- createKeyAndOutput ( accountStack , region , defaultEncryptionKeys ) ;
556+ createKeyAndOutput ( accountStack , region , defaultEncryptionKeys , props . acceleratorPrefix ) ;
558557 }
559558 }
560559
@@ -565,11 +564,15 @@ function createKeyAndOutput(
565564 accountStack : AccountStack ,
566565 region : string ,
567566 defaultEncryptionKeys : LogAccountDefaultEncryptionKeys ,
567+ prefix : string ,
568568) {
569569 // Create a default EBS encryption key for every other region of the log account
570570 const keyAlias = createEncryptionKeyName ( 'Default-Key' ) ;
571571 // Default EBS encryption key
572- const key = createDefaultS3Key ( { accountStack } ) . encryptionKey ;
572+ const key = createDefaultS3Key ( {
573+ accountStack,
574+ prefix,
575+ } ) . encryptionKey ;
573576
574577 defaultEncryptionKeys [ accountStack . accountKey ] = {
575578 ...defaultEncryptionKeys [ accountStack . accountKey ] ,
0 commit comments