Packer Terraform Ansible Wireguard DigitalOcean

sudo pacman -Syu packer terraform ansible

Export API key export TF_VAR_do_api_token="" or add to packer/template.json, terraform/terraform.tfvars.

Validate template files.

cd packer
packer validate template.json

Build image.

packer build template.json

Initialize Terraform.

terraform init

Preview.

terraform plan

Deploy the image to a Droplets.

terraform apply -auto-approve

wireguard configuration(s) will be in wg_download_path(defined in ansible/roles/wireguard/defaults/main.yml).

Destroy/del Droplets.

terraform destroy -auto-approve