Skip to content

Commit 8b4f4ef

Browse files
committed
Update to TF 0.12 and 2nd edition of book
1 parent 2b64b2e commit 8b4f4ef

File tree

316 files changed

+6952
-1616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

316 files changed

+6952
-1616
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[webservers]
2+
11.11.11.11
3+
11.11.11.12
4+
11.11.11.13
5+
11.11.11.14
6+
11.11.11.15
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- hosts: webservers
2+
roles:
3+
- webserver
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- ec2:
2+
count: 10
3+
image: ami-0c55b159cbfafe1f0
4+
instance_type: t2.micro
5+
6+
- ec2:
7+
count: 5
8+
image: ami-0c55b159cbfafe1f0
9+
instance_type: t2.micro
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- name: Update the apt-get cache
2+
apt:
3+
update_cache: yes
4+
5+
- name: Install PHP
6+
apt:
7+
name: php
8+
9+
- name: Install Apache
10+
apt:
11+
name: apache2
12+
13+
- name: Copy the code from the repository
14+
git: repo=https://github.com/brikis98/php-app.git dest=/var/www/html/app
15+
16+
- name: Start Apache
17+
service: name=apache2 state=started enabled=yes

code/bash/01-why-terraform/setup-webserver.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ set -e
66
# Update the apt-get cache
77
sudo apt-get update
88

9-
# Install PHP
10-
sudo apt-get install -y php
11-
12-
# Install Apache
13-
sudo apt-get install -y apache2
9+
# Install PHP and Apache
10+
sudo apt-get install -y php apache2
1411

1512
# Copy the code from the repository
1613
sudo git clone https://github.com/brikis98/php-app.git /var/www/html/app

code/bash/03-terraform-state/user-data.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ cat > index.html <<EOF
66
<p>DB port: ${db_port}</p>
77
EOF
88

9-
nohup busybox httpd -f -p "${server_port}" &
9+
nohup busybox httpd -f -p ${server_port} &

code/packer/01-why-terraform/webserver.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
"builders": [{
33
"ami_name": "packer-example",
44
"instance_type": "t2.micro",
5-
"region": "us-east-1",
5+
"region": "us-east-2",
66
"type": "amazon-ebs",
7-
"source_ami": "ami-40d28157",
7+
"source_ami": "ami-0c55b159cbfafe1f0",
88
"ssh_username": "ubuntu"
99
}],
1010
"provisioners": [{
1111
"type": "shell",
1212
"inline": [
1313
"sudo apt-get update",
14-
"sudo apt-get install -y php",
15-
"sudo apt-get install -y apache2",
14+
"sudo apt-get install -y php apache2",
1615
"sudo git clone https://github.com/brikis98/php-app.git /var/www/html/app"
16+
],
17+
"environment_vars": [
18+
"DEBIAN_FRONTEND=noninteractive"
1719
]
1820
}]
1921
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def example_function()
2+
puts "Hello, World"
3+
end
4+
5+
# Other places in your code
6+
example_function()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def example_function(param1, param2)
2+
return "Hello, #{param1} #{param2}"
3+
end
4+
5+
# Other places in your code
6+
return_value = example_function("foo", "bar")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def example_function(param1, param2)
2+
puts "Hello, #{param1} #{param2}"
3+
end
4+
5+
# Other places in your code
6+
example_function("foo", "bar")

0 commit comments

Comments
 (0)