Created
April 23, 2016 15:58
-
-
Save swade1987/9d189687a2fc2e46fa7b159b78477617 to your computer and use it in GitHub Desktop.
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" "gocd_agent" { | |
image_id = "${var.ami}" | |
name_prefix = "gocd-agent-launch-configuration" | |
instance_type = "${var.instance_type}" | |
security_groups = ["${aws_security_group.gocd_agent.id}"] | |
associate_public_ip_address = false | |
ebs_optimized = false | |
key_name = "${var.key_name}" | |
iam_instance_profile = "${aws_iam_instance_profile.gocd_agent.id}" | |
user_data = "${template_file.init.rendered}" | |
lifecycle {create_before_destroy = true} | |
} | |
resource "aws_autoscaling_group" "gocd_agent" { | |
launch_configuration = "${aws_launch_configuration.gocd_agent.id}" | |
vpc_zone_identifier = ["${split(",", var.public_subnets)}"] | |
lifecycle { create_before_destroy = true } | |
health_check_grace_period = "900" | |
health_check_type = "EC2" | |
load_balancers = ["${aws_elb.gocd_elb.name}"] | |
name = "gocd-agent-autoscaling-group - ${aws_launch_configuration.gocd_agent.id}" | |
max_size = "${var.number_of_instances}" | |
min_size = "${var.minimum_number_of_instances}" | |
desired_capacity = "${var.number_of_instances}" | |
default_cooldown = 30 | |
tag { | |
key = "Name" | |
value = "gocd-agent" | |
propagate_at_launch = true | |
} | |
tag { | |
key = "role" | |
value = "gocd-agent" | |
propagate_at_launch = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment