Terraform + Private Repo Clone with SSH Key

Download Terraform
Extract zip file
→ run terraform.exe
check terraform version
terraform --version

Create API Tokens in Digital Ocean
Go to and log in to your account.
Generate a New Token
Name the Token
Expiration :- 30/60/90 days and No Expire
Set Permissions :- full access
Screenshot 2024-09-18 171244.png

Create GitHub Personal Access Token

Go to Settings
image.png
Scroll Down to Developer Settings
image.png

Click on Tokens(classic)
image.png

Generate new token (classic)
image.png
image.png

Add this permission
image.png
image.png
Generate token and save it.

Download terraform code from here


Create terraform.tfvars file for variables
.tfvars file
do_token = "DIGITAL_OCEAN_TOKEN"
droplet_name = "Dropet_Name"
droplet_region = "blr1"
droplet_size = "s-1vcpu-1gb"
droplet_image = "ubuntu-24-04-x64"
github_repo = "git@github.com:user_name/repo_name.git"
ssh_public_key_path = " " # id_rsa.pub file location path
ssh_private_key_path = " " #id_rsa file location path
node_version = "18" # node version
domain_name = " " # domain name for nginx
github_pat = " " #Github Access token

Save the file
→ Open Terminal in that Folder
terraform init

terraform plan

terraform apply

in terminal
it print out Droplet URL

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.