You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The AWS::CloudFront::OriginRequestPolicy resource type requires a Name to be set. For most CDK constructs, the CDK passes this requirement through to the construct properties by requiring the corresponding property to be specified. However the OriginRequestPolicy construct makes this parameter optional. If it is left empty, the CDK appends the cdk stack id with the generated logical id for the resource as the Name.
This is problematic if you have two different CDK projects that use the same CDK stack name (not to be confused with the Cloudformation stack name), the same CDK logical ids for the construct hierarchy, and deploy to the same AWS account. This will end up generating the same logical Cloudformation resource id and therefore the same policy name. This will cause the Cloudformation stack to fail to deploy due to the name collision.
Describe the solution you'd like
The simple solution would be to allow consumers of the nextjs construct to optionally specify a name for the origin request policy. The default behavior will stay the same as it is now for backward compatibility but it enables a clean workaround for anyone that ends up in this situation by creating a policy name based off of the stack name or other unique key.
Describe alternatives you've considered
It might be possible to introduce a prefix to the CDK logical id of the construct which will cause it's cdk logical id to be different, but this is not a best practice for writing CDK stacks.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The
AWS::CloudFront::OriginRequestPolicy
resource type requires aName
to be set. For most CDK constructs, the CDK passes this requirement through to the construct properties by requiring the corresponding property to be specified. However theOriginRequestPolicy
construct makes this parameter optional. If it is left empty, the CDK appends the cdk stack id with the generated logical id for the resource as theName
.This is problematic if you have two different CDK projects that use the same CDK stack name (not to be confused with the Cloudformation stack name), the same CDK logical ids for the construct hierarchy, and deploy to the same AWS account. This will end up generating the same logical Cloudformation resource id and therefore the same policy name. This will cause the Cloudformation stack to fail to deploy due to the name collision.
Describe the solution you'd like
The simple solution would be to allow consumers of the nextjs construct to optionally specify a name for the origin request policy. The default behavior will stay the same as it is now for backward compatibility but it enables a clean workaround for anyone that ends up in this situation by creating a policy name based off of the stack name or other unique key.
Describe alternatives you've considered
It might be possible to introduce a prefix to the CDK logical id of the construct which will cause it's cdk logical id to be different, but this is not a best practice for writing CDK stacks.
The text was updated successfully, but these errors were encountered: