Skip to content

Commit

Permalink
Regenerate with several fixes and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
brikis98 committed Jan 5, 2017
1 parent e77b8f9 commit 99be177
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 102 deletions.
2 changes: 1 addition & 1 deletion code/bash/01-why-terraform/setup-webserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sudo apt-get install -y php
# Install Apache
sudo apt-get install -y apache2

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

# Start Apache
Expand Down
49 changes: 0 additions & 49 deletions code/terraform/01-why-terraform/server-db-elb/README.md

This file was deleted.

40 changes: 0 additions & 40 deletions code/terraform/01-why-terraform/server-db-elb/main.tf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resource "aws_instance" "example" {
instance_type = "t2.micro"
vpc_security_group_ids = ["${aws_security_group.instance.id}"]

user_data = <<EOF
user_data = <<-EOF
#!/bin/bash
echo "Hello, World" > index.html
nohup busybox httpd -f -p "${var.server_port}" &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ provider "aws" {
}

module "webserver_cluster" {
source = "[email protected]:brikis98/terraform-up-and-running-code.git//code/terraform/04-terraform-module/module-example/modules/services/webserver-cluster?ref=v0.0.1"
source = "[email protected]:brikis98/terraform-up-and-running-code.git//code/terraform/04-terraform-module/module-example/modules/services/webserver-cluster?ref=v0.0.2"

cluster_name = "webservers-stage"
db_remote_state_bucket = "${var.db_remote_state_bucket}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ provider "aws" {

data "aws_availability_zones" "all" {}

resource "aws_instance" "example" {
count = 3
ami = "ami-40d28157"
instance_type = "t2.micro"
}

resource "aws_instance" "example" {
count = "${var.num_availability_zones}"
availability_zone = "${element(data.aws_availability_zones.all.names, count.index)}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ resource "aws_launch_configuration" "example" {
instance_type = "${var.instance_type}"
security_groups = ["${aws_security_group.instance.id}"]

user_data = "${var.enable_new_user_data ?
data.template_file.user_data_new.0.rendered :
data.template_file.user_data.0.rendered}"
user_data = "${element(
concat(data.template_file.user_data.*.rendered,
data.template_file.user_data_new.*.rendered),
0)}"

lifecycle {
create_before_destroy = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ data "template_file" "user_data" {
}

resource "aws_autoscaling_group" "example" {
name = "${var.cluster_name}-${aws_launch_configuration.example.name}"
name = "${var.cluster_name}-${aws_launch_configuration.example.name}"

launch_configuration = "${aws_launch_configuration.example.id}"
availability_zones = ["${data.aws_availability_zones.all.names}"]
load_balancers = ["${aws_elb.example.name}"]
Expand Down

0 comments on commit 99be177

Please sign in to comment.