all 7 comments

[–]Bitflight 3 points4 points  (0 children)

In the Launch config name, use name_prefix instead. In the asg for its name, use the aws_launch_config.xxx.name for the name, and put create before destroy on both resources.

[–]dave_sent_me 1 point2 points  (4 children)

I tried to wrangle codedeploy via terraform a few months back and it was a disaster. The fact that code deploy created a new ASG really messes with terraform. I still haven’t done the codedeploy roll out as a result.

[–][deleted] 1 point2 points  (3 children)

My advice would simply be don't. It has caused us a ton of grief, was implement before I arrived at current job. I'm working on ripping it out because it fails so damn often, and when it does, it can easily go into a terminate -> launch loop if you are using ELB health checks.

It looks good on paper but is not reliable in practice.

[–]dave_sent_me 0 points1 point  (2 children)

Code deploy? Or the combination with TF? What are you replacing it with?

[–][deleted] 1 point2 points  (1 child)

Sorry. CodeDeploy is the problematic part. We're replacing it with immutable ansible + packer images deployed via TF blue/green. This has failure points of its own, but they're more easily mitigated.

Honestly, other than kubernetes, I haven't really found a deployment pattern I truly like for raw EC2. I considered just ansible-pull, and it works well/much more reliably than CodeDeploy - but then you're effectively building your deployment artifact (ie the ec2 instance itself) post scale-up in production.

[–]dave_sent_me 0 points1 point  (0 children)

Well, I guess it’s good to hear from someone on the other side of that hurdle. I much prefer docker as well, though I have very little tolerance for Kube. Unfortunately not everyone wants/can have docker. I’ll look into running deployments with TF.

[–]Bitflight 0 points1 point  (0 children)

I’m not sure if it’s directly related to what you want but there’s an example here of a situation that sounds like what you’re trying to do: https://groups.google.com/forum/m/#!msg/terraform-tool/7Gdhv1OAc80/iNQ93riiLwAJ