Example of DigitalOcean deployment for Czechitas DA: Projekt
- Sign-up
- Create an API token: Account -> API -> Tokens/Keys -> Generate New Token
- Create an SSH key: Account -> Settings -> Security -> Add SSH Key. This key will be used to authenticate SSH connection to the server. You will need name of this key later.
- Install Terraform
- Install SSH agent and import your SSH key to it. It must be running when you execute
terraform apply
. Terraform will establish SSH connection to the new server, and it doesn't support password protected SSH keys. So we need SSH agent. - Switch to
./terraform
directory - Run
terraform init
- this will initialize local state storage. - Create
terraform.tfvars
file with content like:do_token = "YOUR_DIGITALOCEAN_API_TOKEN" ssh_key_name = "NAME_OF_THE_SSH_KEY_IN_DIGITALOCEAN"
- Run
terraform plan
to review all the resources that will be created. - Run
terraform apply
- all the resources will be created. - Run
terraform destroy
to destroy all the created resources.