Skip to content

Terraform configuration for creation of DigitalOcean Droplet (of managed image, size, region) with ability to deploy project with boot scripts

Notifications You must be signed in to change notification settings

ykholm/tf-droplet-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

It's a Terraform Project that can help you to create DigitalOcean droplet with managed architecture and SSH key based access.

Project Actions:

  1. Creates new DigitalOcean Droplet with:
    • image: ubuntu-20-04-x64
    • name: tf-vm
    • size: droplet_size
    • region: fra1
  2. Creates new TLS private key certificate.
  3. Zips source project (with possible boot bash script inside).
  4. Copies, unzips, and launches boot script on Droplet (if exists).

Dependencies

  1. Docker
  2. Terraform
  3. Digital Ocean Personal Token
  4. Project: (absolute path) + bash script inside project root (optional, uses as initial boot script)

Quick start

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

About

Terraform configuration for creation of DigitalOcean Droplet (of managed image, size, region) with ability to deploy project with boot scripts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published