Hey there,
Currently we're migrating a serverless project to use the CDK. What we're experiencing now is that despite setting an ID for an Origin behavior it is always overwritten by origin{indexOfBehavior+1}. I also found that there is no typesafe way in TypeScript to set this property on Behavior, because it doesn't exist on that type. The parent construct CloudFrontWebDistribution is internally using an unexported type for behaviors called BehaviorWithOrigin.
The constructor of CloudFrontWebDistribution is overwriting any specified (by sidestepping the typechecker) origin id, see here.
My question now is: is that the expected behavior of the CDK? Like, is this intentional to prevent people to have colliding origin IDs? Or is this a bug/feature?
Indeed the current API doesn't allow specifying origin ID. I am curious, what is your use case for explicitly setting the origin ID?
Closing for now since there hasn't been a response in a while. Feel free to reopen.
doesn't need to reopen but I was lead here by google because I wanted to give my origins friendlier names to help make identifying them easier while troubleshooting, not the most critical use case but a _would be nice_ for me anyway
This feature exists in the actual service and other tools such as Terraform but not CDK. I can see why it is low priority but I can't see a reason NOT to implement it.
My use case is that we have a CloudFront distribution with a large number of cache behaviors. It acts as a sort of router to dispatch paths to various back end services. When looking at the list of behaviors in the console it would be very helpful if we could give the origins a meaningful name so we do not have to constantly flip back and forth between the behaviors and origins tab to see what "originN" is and try to remember all those.
@njlynch Do you know if we can implement this now? Seems like the original issue was a while back
Thanks for the tag, @iliapolo . Yes, I think this is a reasonable feature request. I'll re-open.
Most helpful comment
doesn't need to reopen but I was lead here by google because I wanted to give my origins friendlier names to help make identifying them easier while troubleshooting, not the most critical use case but a _would be nice_ for me anyway