cloudposse/terraform-aws-ec2-autoscale-group

Initial Implementation

Closed this issue · 4 comments

My general thoughts are that it should include the following resources:

  • launch config
  • autoscaling group
  • security group
  • dns record
  • iam instance profile
  • iam role
  • elb (w/ variable for enabled)
  • eip (w/ variable for enabled)

Variables:

  • min/max size
  • enabled
  • volume size
  • vpc id
  • user data script var (this would need to be a path using ${path.module} syntax in local module)
  • elb enabled/disabled
  • eip enabled/disabled
  • dns zone id
  • security groups

Resources sound good, except for not sure how we can leverage the DNS record with an ASG?

We should also define the outputs. I think they would be...

outputs

  • security_group_id

variables

  • instance_type
  • namespace, stage, name, attributes, delimiter, tags - for label module
  • subnet_ids
  • ssh_key_pair

Note, the labels module will output tags_as_list_of_maps or something like that which is suitable for the autoscale group.

references

Refer to these modules/variables for inspiration:

Note, @Jamie-BitFlight has offered to donate any/all of his code under the bitflight-public repo to our cause, so feel free to borrow heavily against it @MoonMoon1919

That sounds good. I like that.

I was thinking the DNS record would be used only if enabled and an ELB and EIP was requested. Thoughts?

I think the ALB belongs outside of this module for greatest flexibility and re-use. For example, we're using these ALB modules for ECS, but they will work for many other use-cases.

Check these out:

Perhaps the module can take as an input the target groups ARNs and use the aws_autoscaling_attachment resource in the autoscale module to attach to those arns. This will let you use the alb-ingress module to route traffic to that ARN.

https://www.terraform.io/docs/providers/aws/r/autoscaling_attachment.html

I like that, sounds good!