Setting up Terraform to provision a DigitalOcean Droplet

By following the example repo, I managed to setup a simple example app by following Hashicorps guide.

I am summarizing the steps I took here for reference. For a more concrete explanation, check out the example docs.

  1. Get a DigitalOcean Token from here
  2. Run export DIGITALOCEAN_ACCESS_TOKEN=<API TOKEN> in your local shell
  3. cd terraform
  4. Generate a new SSH key pair
ssh-keygen -t rsa -C "<email>" -f ./terraform-digitalocean
  1. Copy over the generated public ssh into terramino_app.yaml
  2. Initialize terraform using terraform init
  3. Check what changes are gonna be done using terraform plan
  4. Apply the changes using terraform apply
    The public IP of the resource will be outputted after command completion.

It is astounding how simple the process has become. This pull request has the changes I made for getting the app to work. To see the entire code base, click here.

Next Step

Once we provision the machine, we need to generate the inventory file that ansible needs from the output of terraformer.

https://blog.edwinclement08.com/post/automatic-creation-of-inventory-from-terraformer/

Project Page

Related Posts

One thought on “Setting up Terraform to provision a DigitalOcean Droplet

Leave a Reply

%d bloggers like this: