asg.tf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. user_data = "${file("userdata.sh")}"
  13. root_block_device {
  14. volume_type = "gp2"
  15. volume_size = 20
  16. delete_on_termination = true
  17. }
  18. }
  19. resource "aws_autoscaling_group" "asg_nuxeo" {
  20. name = "asg_nuxeo"
  21. health_check_grace_period = 60
  22. health_check_type = "EC2"
  23. launch_configuration = "${aws_launch_configuration.asg_launch_nuxeo.name}"
  24. max_size = "${var.asg_max}"
  25. min_size = "${var.asg_min}"
  26. desired_capacity = "${var.asg_desired}"
  27. vpc_zone_identifier = ["${var.app_subnets}"]
  28. target_group_arns = ["${aws_alb_target_group.nuxeo.arn}"]
  29. tag {
  30. key = "role"
  31. value = "nuxeo"
  32. propagate_at_launch = true
  33. }
  34. }