DO sections in docs
1# most simple
2arkade get doctl
3
4# normal way
5curl -OL https://github.com/digitalocean/doctl/releases/download/v1.104.0/doctl-1.104.0-linux-amd64.tar.gz
6tar xf doctl-1.104.0-linux-amd64.tar.gz
7mv doctl /usr/local/bin
8
9# Auto-Completion ZSH
10 doctl completion zsh > $ZSH/completions/_doctl
1doctl compute region list
2doctl compute size list
3doctl compute image list-distribution
4doctl compute image list --public
1doctl auth init --context test
2doctl auth list
3doctl auth switch --context test2
1doctl projects create --name rkub --environment staging --purpose "stage rkub with github workflows"
1doctl compute ssh-key list
2doctl compute droplet create test --region fra1 --image rockylinux-9-x64 --size s-1vcpu-1gb --ssh-keys <fingerprint>
3doctl compute droplet delete test -f
1export DO_PAT="dop_v1_xxxxxxxxxxxxxxxx"
2doctl auth init --context rkub
3
4# inside a dir with a tf file
5terraform init
6terraform validate
7terraform plan -var "do_token=${DO_PAT}"
8terraform apply -var "do_token=${DO_PAT}" -auto-approve
9
10# clean apply
11terraform plan -out=infra.tfplan -var "do_token=${DO_PAT}"
12terraform apply infra.tfplan
13
14# Control
15terraform show terraform.tfstate
16
17# Destroy
18terraform plan -destroy -out=terraform.tfplan -var "do_token=${DO_PAT}"
19terraform apply terraform.tfplan
Connect to Droplet with private ssh key ssh root@$(terraform output -json ip_address_workers | jq -r ‘.[0]’) -i .key