Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates with working version of code #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions terraform_demo/autoscaling_groups/webapp-asg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resource "aws_autoscaling_group" "webapp_asg" {
name = "demo_webapp_asg-${var.webapp_lc_name}"
max_size = "${var.asg_max}"
min_size = "${var.asg_min}"
wait_for_elb_capacity = false
wait_for_elb_capacity = 1
force_delete = true
launch_configuration = "${var.webapp_lc_id}"
load_balancers = ["${var.webapp_elb_name}"]
Expand Down Expand Up @@ -45,7 +45,7 @@ resource "aws_cloudwatch_metric_alarm" "scale_up_alarm" {
statistic = "Average"
threshold = "80"
insufficient_data_actions = []
dimensions {
dimensions = {
AutoScalingGroupName = "${aws_autoscaling_group.webapp_asg.name}"
}
alarm_description = "EC2 CPU Utilization"
Expand Down Expand Up @@ -73,7 +73,7 @@ resource "aws_cloudwatch_metric_alarm" "scale_down_alarm" {
statistic = "Average"
threshold = "30"
insufficient_data_actions = []
dimensions {
dimensions = {
AutoScalingGroupName = "${aws_autoscaling_group.webapp_asg.name}"
}
alarm_description = "EC2 CPU Utilization"
Expand Down
2 changes: 1 addition & 1 deletion terraform_demo/instances/bastion.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resource "aws_instance" "bastion" {
subnet_id = "${var.public_subnet_id}"
associate_public_ip_address = true
vpc_security_group_ids = ["${var.bastion_ssh_sg_id}"]
key_name = "${var.key_name}"
key_name = "oregon"
}

resource "aws_eip" "bastion" {
Expand Down
2 changes: 1 addition & 1 deletion terraform_demo/instances/private_subnet_instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ resource "aws_instance" "private_subnet_instance" {
"${var.ssh_from_bastion_sg_id}",
"${var.web_access_from_nat_sg_id}"
]
key_name = "${var.key_name}"
key_name = "oregon"
}
2 changes: 1 addition & 1 deletion terraform_demo/launch_configurations/webapp-lc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "aws_launch_configuration" "webapp_lc" {
"${var.webapp_outbound_sg_id}"
]
user_data = "${file("./launch_configurations/userdata.sh")}"
key_name = "${var.key_name}"
key_name = "oregon"
associate_public_ip_address = true
}
output "webapp_lc_id" {
Expand Down
2 changes: 1 addition & 1 deletion terraform_demo/load_balancers/webapp-elb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "aws_elb" "webapp_elb" {
interval = 10
}
security_groups = ["${var.webapp_http_inbound_sg_id}"]
tags {
tags = {
Name = "terraform_elb"
}
}
Expand Down
4 changes: 2 additions & 2 deletions terraform_demo/site/bastion-sg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "aws_security_group" "bastion_ssh_sg" {
cidr_blocks = ["0.0.0.0/0"]
}
vpc_id = "${aws_vpc.default.id}"
tags {
tags = {
Name = "terraform_bastion_ssh"
}
}
Expand All @@ -45,7 +45,7 @@ resource "aws_security_group" "ssh_from_bastion_sg" {
]
}
vpc_id = "${aws_vpc.default.id}"
tags {
tags = {
Name = "terraform_ssh_from_bastion"
}
}
Expand Down
4 changes: 2 additions & 2 deletions terraform_demo/site/nat-sg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "aws_security_group" "nat" {
cidr_blocks = ["0.0.0.0/0"]
}
vpc_id = "${aws_vpc.default.id}"
tags {
tags = {
Name = "terraform"
}
}
Expand Down Expand Up @@ -72,7 +72,7 @@ resource "aws_security_group" "web_access_from_nat_sg" {
cidr_blocks = ["0.0.0.0/0"]
}
vpc_id = "${aws_vpc.default.id}"
tags {
tags = {
Name = "terraform"
}
}
Expand Down
16 changes: 8 additions & 8 deletions terraform_demo/site/pub_priv_vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
resource "aws_vpc" "default" {
cidr_block = "${var.vpc_cidr}"
enable_dns_hostnames = true
tags {
tags = {
Name = "terraform_vpc"
}
}

resource "aws_internet_gateway" "default" {
vpc_id = "${aws_vpc.default.id}"
tags {
tags = {
Name = "terraform_igw"
}
}
Expand All @@ -33,12 +33,12 @@ resource "aws_instance" "nat" {
ami = "ami-75ae8245" # this is a special ami preconfigured to do NAT
availability_zone = "${element(var.availability_zones, 0)}"
instance_type = "t2.small"
key_name = "${var.key_name}"
key_name = "oregon"
security_groups = ["${aws_security_group.nat.id}"]
subnet_id = "${aws_subnet.demo_public.id}"
associate_public_ip_address = true
source_dest_check = false
tags {
tags = {
Name = "terraform_nat_instance"
}
}
Expand All @@ -55,7 +55,7 @@ resource "aws_subnet" "demo_public" {
vpc_id = "${aws_vpc.default.id}"
cidr_block = "${var.public_subnet_cidr}"
availability_zone = "${element(var.availability_zones, 0)}"
tags {
tags = {
Name = "terraform_public_subnet"
}
}
Expand All @@ -69,7 +69,7 @@ resource "aws_route_table" "demo_public" {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.default.id}"
}
tags {
tags = {
Name = "terraform_public_subnet_route_table"
}
}
Expand All @@ -86,7 +86,7 @@ resource "aws_subnet" "demo_private" {
vpc_id = "${aws_vpc.default.id}"
cidr_block = "${var.private_subnet_cidr}"
availability_zone = "${element(var.availability_zones, 0)}"
tags {
tags = {
Name = "terraform_private_subnet"
}
}
Expand All @@ -100,7 +100,7 @@ resource "aws_route_table" "demo_private" {
cidr_block = "0.0.0.0/0"
instance_id = "${aws_instance.nat.id}"
}
tags {
tags = {
Name = "terraform_private_subnet_route_table"
}
}
Expand Down
6 changes: 3 additions & 3 deletions terraform_demo/site/webapp-sg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "aws_security_group" "webapp_http_inbound_sg" {
cidr_blocks = ["0.0.0.0/0"]
}
vpc_id = "${aws_vpc.default.id}"
tags {
tags = {
Name = "terraform_demo_webapp_http_inbound"
}
}
Expand All @@ -42,7 +42,7 @@ resource "aws_security_group" "webapp_ssh_inbound_sg" {
cidr_blocks = ["${var.ip_range}"]
}
vpc_id = "${aws_vpc.default.id}"
tags {
tags = {
Name = "terraform_demo_webapp_ssh_inbound"
}
}
Expand All @@ -60,7 +60,7 @@ resource "aws_security_group" "webapp_outbound_sg" {
cidr_blocks = ["0.0.0.0/0"]
}
vpc_id = "${aws_vpc.default.id}"
tags {
tags = {
Name = "terraform_demo_webapp_outbound"
}
}
Expand Down