The Terraform Book
TheTerraformBook_sample
TheTerraformBook_sample
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 3: Building an application stack with <strong>Terraform</strong><br />
Listing 3.74: Creating the files directory<br />
$ pwd<br />
~/terraform/web<br />
$ mkdir files<br />
$ cd files<br />
$ touch web_bootstrap.sh<br />
Let’s add some commands to the web_bootstrap.sh script.<br />
Listing 3.75: <strong>The</strong> web_bootstrap.sh script<br />
#!/bin/bash<br />
sudo apt-get update<br />
sudo apt-get install -y nginx<br />
sudo service nginx start<br />
Now when our instances launch Nginx will automatically be installed and started.<br />
We’ll see the results of this when we apply our configuration.<br />
TIP It might take some time after the instance is launched to complete the<br />
installation process. Be patient! You can SSH into the instances to check the<br />
progress if required.<br />
We’re going to focus on more complex provisioning in Chapter 4. For now let’s<br />
finish building our stack.<br />
Version: v1.1.1 (e771e4d) 59