- Terraform
- Account at Digital Ocean
- Generated token at Digital Ocean
- Ssh key added to your Digital Ocean account
- Get your pub key fingerprint, use ssh-keygen -E md5 -lf when md5.
- Enough credits on your Digital Ocean account :-)
- Deployment centos7 OS with terraform
- System update to latest centos7
Set environment variables
export DO_PAT=[your generated toke]
export SSH_FINGERPRINT="[your public key fingerprint]"
export TF_LOG=1
Check your infrastructure execution plan
terraform plan \
-var "do_token=${DO_PAT}" \
-var "pub_key=~/.ssh/id_rsa.pub" \
-var "pvt_key=~/.ssh/id_rsa" \
-var "ssh_fingerprint=$SSH_FINGERPRINT"
Apply your infrastructure execution plan
terraform apply \
-var "do_token=${DO_PAT}" \
-var "pub_key=~/.ssh/id_rsa.pub" \
-var "pvt_key=~/.ssh/id_rsa" \
-var "ssh_fingerprint=$SSH_FINGERPRINT"
Show your infrastructure setup
terraform show
digitalocean_droplet.centos7node1:
id = 9639873
image = centos-7-0-x64
ipv4_address = [public ip]
ipv4_address_private = [private ip]
locked = false
name = centos7node1
private_networking = true
region = ams3
size = 512mb
ssh_keys.# = 1
ssh_keys.0 = [your fingerprint]
status = active
digitalocean_droplet.centos7node2:
id = 9639874
image = centos-7-0-x64
ipv4_address = [public ip]
ipv4_address_private = [private ip]
locked = false
name = centos7node2
private_networking = true
region = ams3
size = 512mb
ssh_keys.# = 1
ssh_keys.0 = [your fingerprint]
status = active