This project uses Packer from Hashicorp to create custom droplet images with everything setup.
The Packer configuration uses a variable file for its secrets: packer-secrets.json
. You'll find an example file in this repo for the structure to follow.
To build your snapshot using Packer:
packer build \
-var 'size=s-1vcpu-1gb' \
-var-file 'packer-secrets.json' \
packer.json
This terraform configuration requires multiples variables files for which you can find examples in the repository:
secrets.tfvars
ssh_keys.tfvars
You need to copy-paste the examples, remove the .example
in the name of the file and fill them up with your real data.
You can create the infrastructure with terraform apply -var-file="secrets.tfvars" -var-file="ssh_keys.tfvars"
This article gives guidelines to improve terraform usage: https://cloudskiff.com/terraform-code-quality/?utm_source=Slack&utm_medium=TerraformCodeQuality.