Ranvijay Jamwal
Ranvijay Jamwal

Reputation: 671

Deploying Code and Managing configuration with Terraform

Just to give context:

  1. I am planning to use Terraform to bring up new separate environments with ec2 machines, elb etc. and then maintaining configuration as well. Doing that with terraform and using AWS provider sounds fairly simple.

Problem 1: While launching those instances I want to install few packages etc. so that when Terraform launches the instances (servers) things/ apps should be up and running.

Assuming the above is up and running:

Problem 2: How do I deploy new code on the servers in this environment launched by Terraform? Should I use for eg. ansible playbooks/chef recipes/puppet manifests for that? or Terraform gives some other options/ways?

Upvotes: 1

Views: 206

Answers (1)

Julio Daniel Reyes
Julio Daniel Reyes

Reputation: 6365

Brief answers:

Problem 1: While launching those instances I want to install few packages etc. so that when Terraform launches the instances (servers) things/ apps should be up and running.

A couple of options:

  1. Create an AMI of your instance with the installed packages and specify that in the resource.
  2. Use the user data script to install the packages that you need when the instance starts.
  3. Use ansible playbooks/chef recipes/puppet to install packages once the instance is running (e.g. creating an opsworks stack with terraform)

Problem 2: How do I deploy new code on the servers in this environment launched by Terraform? Should I use for eg. ansible playbooks/chef recipes/puppet manifests for that? or Terraform gives some other options/ways?

Not the intended use case for terraform, use other tools like jenkins or aws services like codepipeline or codedeploy. Ansible/chef/puppet can also help (e.g. with opsworks)

Upvotes: 0

Related Questions