asg.tf 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /***************************************************
  2. * AUTO SCALING GROUP FOR NUXEO INSTANCE
  3. ****************************************************/
  4. resource "aws_launch_configuration" "asg_launch_nuxeo" {
  5. name = "asg_launch_nuxeo"
  6. image_id = "ami-2b10bc4b"
  7. instance_type = "t2.micro"
  8. key_name = "packer_5832e178-3196-2110-e869-232a71aa6853"
  9. security_groups = ["${var.alb_secgroups}"]
  10. enable_monitoring = false
  11. ebs_optimized = false
  12. #iam_instance_profile = "${aws_iam_instance_profile.nuxeo_instance_profile.id}"
  13. user_data = "${file("userdata.sh")}"
  14. root_block_device {
  15. volume_type = "gp2"
  16. volume_size = 20
  17. delete_on_termination = true
  18. }
  19. }
  20. resource "aws_autoscaling_group" "asg_nuxeo" {
  21. name = "asg_nuxeo"
  22. health_check_grace_period = 60
  23. health_check_type = "EC2"
  24. launch_configuration = "${aws_launch_configuration.asg_launch_nuxeo.name}"
  25. max_size = "${var.asg_max}"
  26. min_size = "${var.asg_min}"
  27. desired_capacity = "${var.asg_desired}"
  28. vpc_zone_identifier = ["${var.app_subnets}"]
  29. target_group_arns = ["${aws_alb_target_group.nuxeo.arn}"]
  30. tag {
  31. key = "role"
  32. value = "nuxeo"
  33. propagate_at_launch = true
  34. }
  35. }