Google Cloud SQL replica create and promote

I have an existing Google Cloud SQL database instance.
I want to set up a read replica for this instance via Terraform script.
Can you provide an example for that?

Also after I have the read replica I want to promote the replica to a standalone instance via Terraform script.
Is this possible via Terraform? If yes, can you provide an example of that also?