File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed
deployments/cdk/src/deployments/defaults
lib/cdk-constructs/src/s3 Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,15 @@ function createCentralBucketCopy(props: DefaultsStep1Props) {
9898 removalPolicy : cdk . RemovalPolicy . RETAIN ,
9999 } ) ;
100100
101+ // TODO: Remove and use fields directly when CDK enhanced s3.Bucket.
102+ ( bucket . node . defaultChild as s3 . CfnBucket ) . addPropertyOverride ( 'OwnershipControls' , {
103+ Rules : [
104+ {
105+ ObjectOwnership : 'BucketOwnerPreferred' ,
106+ } ,
107+ ] ,
108+ } ) ;
109+
101110 // Let the bucket name be generated by CloudFormation
102111 // The generated bucket name is based on the stack name + logical ID + random suffix
103112 overrideLogicalId ( bucket , `config${ masterAccountStack . region } ` ) ;
@@ -308,6 +317,15 @@ function createAesLogBucket(props: DefaultsStep1Props) {
308317 removalPolicy : cdk . RemovalPolicy . RETAIN ,
309318 } ) ;
310319
320+ // TODO: Remove and use fields directly when CDK enhanced s3.Bucket.
321+ ( logBucket . node . defaultChild as s3 . CfnBucket ) . addPropertyOverride ( 'OwnershipControls' , {
322+ Rules : [
323+ {
324+ ObjectOwnership : 'BucketOwnerPreferred' ,
325+ } ,
326+ ] ,
327+ } ) ;
328+
311329 // Let the bucket name be generated by CloudFormation
312330 // The generated bucket name is based on the stack name + logical ID + random suffix
313331 overrideLogicalId ( logBucket , `aes${ logAccountStack . region } ` ) ;
Original file line number Diff line number Diff line change @@ -287,6 +287,15 @@ async function main() {
287287 removalPolicy : cdk . RemovalPolicy . DESTROY ,
288288 } ) ;
289289
290+ // TODO: Remove and use fields directly when CDK enhanced s3.Bucket.
291+ ( installerArtifactsBucket . node . defaultChild as s3 . CfnBucket ) . addPropertyOverride ( 'OwnershipControls' , {
292+ Rules : [
293+ {
294+ ObjectOwnership : 'BucketOwnerPreferred' ,
295+ } ,
296+ ] ,
297+ } ) ;
298+
290299 new codepipeline . Pipeline ( stack , 'Pipeline' , {
291300 role : installerPipelineRole ,
292301 pipelineName : `${ acceleratorPrefix } InstallerPipeline` ,
Original file line number Diff line number Diff line change @@ -47,6 +47,15 @@ export class Bucket extends s3.Bucket {
4747
4848 // Get the underlying resource
4949 this . resource = this . node . findChild ( 'Resource' ) as s3 . CfnBucket ;
50+
51+ // TODO: Remove and use fields directly when CDK enhanced s3.Bucket.
52+ this . resource . addPropertyOverride ( 'OwnershipControls' , {
53+ Rules : [
54+ {
55+ ObjectOwnership : 'BucketOwnerPreferred' ,
56+ } ,
57+ ] ,
58+ } ) ;
5059 }
5160
5261 replicateFrom ( principals : iam . IPrincipal [ ] , organizationId : string , prefix : string ) {
You can’t perform that action at this time.
0 commit comments