I think there are three ways to deal with it.
Cloudfront is just another layer , you can:
- in serverless framework
add cloudfront resources in serverless.yml directly, they use cloudfornation yaml template and syntax.
you can references api gateway resources to cloudfront
- write a seperate cloudformation
output serverless api gateway resource in serverless.yml
deal with cloudfront deployment, reference api gateway resources from cloudformation outputs variables
- write a seperate terraform stack to manage it.
you still need set outputs from serverless, so terraform can reference them
maybe this is the simplest way, but depand on your team skillsets on master terraform.
Please note, cloudfront deployment takes long time, normaly about 15~20 minutes, I recommend split api gateway and cloudfront deployment in two layers