It's a Terraform Project that can help you to create DigitalOcean droplet with managed architecture and SSH key based access.
Project Actions:
- Creates new DigitalOcean Droplet with:
- image:
ubuntu-20-04-x64
- name:
tf-vm
- size:
droplet_size
- region:
fra1
- image:
- Creates new TLS private key certificate.
- Zips source project (with possible boot bash script inside).
- Copies, unzips, and launches boot script on Droplet (if exists).
- Docker
- Terraform
- Digital Ocean Personal Token
- Project: (absolute path) + bash script inside project root (optional, uses as initial boot script)
1. Install Terraform
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
2. Clone Repo
git clone https://github.com/kholmanskykh/tf-droplet-project.git
3. Prepare project to deploy:
- add
boot.sh
script to project root (optional) - copy project absolute path (put to env values)
4. Run inside repo
# setup environment
export TF_VAR_do_token=token # digital ocean token
export TF_VAR_source_abs_project_path=path # project absolute path
# run terraform
terraform init
terraform apply -auto-approve
# or use makefile
make apply
5. Output
Terraform generates following output values and resources after successful run that you can use later:
- Droplet region
- Droplet IPv4 address
/tmp
directory with zipped project and SSH private key
6. Destroy
It is possible to destroy already created resources with:
terraform destroy-auto-approve
# or use makefile
make destory