How to create cloud function implemented using java and built with graddle

Do we need to specify the
“gradle runFunction” in the terraform. Any sample will be helpful.