Skip to content

S3BucketOrigin.withOriginAccessControl: support for cross-stack (bucket and distribution in separate stacks) #31462

@Huink7

Description

@Huink7

Describe the feature

Issue#21771 recently implemented an L2 construct solution for OAC, which is fantastic! However, for my use case it creates a cyclical dependency between our CloudFront Stack distribution Resource.Ref and a separate stack's bucket Resource.RegionalDomainName, where withOriginAccessIdentity does not.

Is it possible to allow buckets created outside of the CloudFront Distribution stack to work with the updated L2 as it does for the OAI implementation https://github.com/aws/aws-cdk/blob/v2.158.0/packages/aws-cdk-lib/aws-cloudfront-origins/lib/s3-bucket-origin.ts#L228?

I did double check that moving the bucket to the same stack resolved the cyclical dependency error, but that resolution will not work for our use case.

Use Case

Unfortunately I am unable to link my code source as its a private emu.
Bucket is created in Stack A
Distribution is created in Stack B referencing bucket from Stack A.

Use case currently works with S3Origin, as well as the updated S3BucketOrigin.withOriginAccessIdentity.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.158.0

Environment details (OS name and version, etc.)

Mac OS Sonoma 14.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-s3Related to Amazon S3bugThis issue is a bug.effort/mediumMedium work item – several days of effortp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions