Can we create EC2 instance and clone the code commit repo and some user data steps in terraform?

Can we create EC2 instance and clone the code commit repo into the created instance and perform some user data steps using terraform?

Thanks

The only part Terraform should play in this process, is passing in appropriate user_data to the instance creation. All the steps after that should be handled by cloud-init running within the instance, directed by the user_data.