Terraform Provisioning
- Lets provision the virtual machine to run a java application
spring-petclinicRefer Here for the java application - Steps for manually installing
- install openjdk 11
- dowload the jar file and execute the jar file by the following command
java -jar <path to spring-petclinic.jar> - commands in linux
sudo apt update
sudo apt install openjdk-11-jdk -y
mkdir ~/apps && cd ~/apps
wget https://referenceapplicationskhaja.s3.us-west-2.amazonaws.com/spring-petclinic-2.4.2.jar
java -jar spring-petclinic-2.4.2.jar &
- This application works on port 8080 so security group rule needs to be created
- Lets use file provisioner to copy the shell script from local machine to remote machine
- Refer Here for the changes done and these changes deploy spring petclinic
- Known issue to be fixed: The application is not running after terraform closes the remote-exec session.
- Passing variables from commandline every time is not a good idea.
- So create a file with .tfvars extension and pass them to terraform apply command
terraform apply -var-file="<filename.tfvars>"
* Refer Here for the changes done
* Next Steps:
* From terraform we will call the ansible playbook and chef cookbook
* Backends
* Note: try this stuff on AWS
