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.
- Get a DigitalOcean Token from here
export DIGITALOCEAN_ACCESS_TOKEN=<API TOKEN>in your local shell
- Generate a new SSH key pair
ssh-keygen -t rsa -C "<email>" -f ./terraform-digitalocean
- Copy over the generated public ssh into
- Initialize terraform using
- Check what changes are gonna be done using
- Apply the changes using
The public IP of the resource will be outputted after command completion.
Once we provision the machine, we need to generate the inventory file that ansible needs from the output of terraformer.