Terraform script to implement rolling deployment for Autoscaling group and ELB
Ami folder contains the packer configuration to create the nginx AMI. Use following command to create the AMI (Use default if you are just using the default profile)
packer build -var aws_profile=<name_of_your_aws_profile> nginx.json
Update the terraform launch configuration to include the AMI Id created with above packer command.
terraform plan -out tfplan
terraform apply tfplan
Create a new AMI to represent new version of the application.
packer build -var aws_profile=<name_of_your_aws_profile> nginx.json
Update terraform with new AMI just created.
Execute terraform plan
terraform plan -out tfplan
This will offer the changes that will perform the rolling deployment.
Apply the changes to see the rolling deployment in action
terraform apply tfplan