Created
June 10, 2018 09:21
-
-
Save ethicalmohit/d6e351498c6c33bb8db2d8dd0726b2f6 to your computer and use it in GitHub Desktop.
This gist has the configuration of the terraform which is responsible to create auto-scaling-group and launch configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_launch_configuration" "launch_configuration" { | |
name = "zox" | |
image_id = "${var.ami_ubuntu}" | |
instance_type = "${var.instance_type}" | |
security_groups = ["${aws_security_group.sg.id}"] | |
key_name = "${var.key_name}" | |
lifecycle { | |
create_before_destroy = true | |
} | |
} | |
resource "aws_autoscaling_group" "autoscaling_group" { | |
name = "asg-${var.environment}" | |
launch_configuration = "${aws_launch_configuration.launch_configuration.id}" | |
availability_zones = ["${var.az1}","${var.az2}","${var.az3}"] | |
min_size = 1 | |
max_size = 5 | |
vpc_zone_identifier = ["${aws_subnet.public-subnet.id}"] | |
load_balancers = ["${aws_elb.testing-elb.name}"] | |
health_check_type = "ELB" | |
tag { | |
key = "Env" | |
value = "${var.environment}" | |
propagate_at_launch = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment