When provisioning an instance, I am using "remote-exec" to execute some commands and then start up a tomcat instance through terraform. It looks something like this:
resource "null_resource" "mount_fss_on_DFSrvr" {
depends_on = ["oci_core_instance.DFSrvr",
"oci_file_storage_export.export_FileListener_FileListenerMount",
]
count = "${var.proddfsrvr_count}"
provisioner "remote-exec" {
connection {
agent = false
timeout = "15m"
host = "${oci_core_instance.DFSrvr.*.public_ip[count.index % var.proddfsrvr_count]}"
user = "opc"
private_key = "${file(var.ssh_private_key)}"
}
inline = [
"some commands",
"./catalina.sh start",
"exit"
]
}
}
The output shows that tomcat was started, but when I look on the instance, the logs show that it hasn't been started(there is no logging). I can ssh into the instance and run "./catalina.sh start" and it works fine. I have also tried creating a service and running "sudo service tomee start" instead of "./catalina.sh start" in the remote-exec inline command, and that doesn't work either. What am I doing wrong here?
null_resource.mount_fss_on_DFSrvr[1] (remote-exec): Using CATALINA_BASE: /apache-tomee-plus-7.0.4
null_resource.mount_fss_on_DFSrvr[1] (remote-exec): Using CATALINA_HOME: /apache-tomee-plus-7.0.4
null_resource.mount_fss_on_DFSrvr[1] (remote-exec): Using CATALINA_TMPDIR: /apache-tomee-plus-7.0.4/temp
null_resource.mount_fss_on_DFSrvr[1] (remote-exec): Using JRE_HOME: /usr
null_resource.mount_fss_on_DFSrvr[1] (remote-exec): Using CLASSPATH: /apache-tomee-plus-7.0.4/bin/bootstrap.jar:/apache-tomee-plus-7.0.4/bin/tomcat-juli.jar
null_resource.mount_fss_on_DFSrvr[1] (remote-exec): Tomcat started.