Doubts about Lambda resource handling (code)

Hi all, quite new Terraform user here. I am coding some Terraform configurations, and it’s not clear for me how the Lambda resource handles the code deployment of already existing functions. My goal is to create the function when it doesn’t exist with a sample code, but if it exists, update the configuration if needed, but keeping the already deployed code as it is (don’t replace), as the Lambda function code is updated using other ways (CI/CD pipeline). Hown can this be done? Thanks!