OCI how to run remote-exec without public ip on the VM

Hello. I’m trying to run remote-exec on newly created VMs from a custom image, this VMs does not have Public IP. How can I run Remote Exec?

This is the current code:

resource “null_resource” “remote-exec” {
depends_on = [
provisioner “remote-exec” {
connection {
agent = false
timeout = “30m”
host = oci_core_instance.Linux_instance.private_ip
user = “techserv”
private_key = file("/var/lib/jenkins/workspace/Repo/id_rsa")
inline = [
“sudo hostnamectl set-hostname testvm”

I found somehwere I could use:
host = oci_core_instance.Linux_instance.private_ip

But the terraform logs shows like the remote-exec is simply being skipped, like if nothing is happening on this stage.

Any insights are appreciated.