How to create an AWS Lambda under an exiting AWS API Gateway?

If I have an existing AWS API Gateway, How can I map it to the AWS Lambda event?
eg. Need to create a new resource path under an existing API Gateway and attach it as an event to the lambda function

The way that I do this (I create my API gateway with terraform) is that I push the API gateway ID’s into SSM parameter store and then retrieve them when I deploy the serverless project.