Code Monkey home page Code Monkey logo

terra-do's Introduction

Terra Linode

License DigitalOcean Terraform OpenTofu Ansible AlmaLinux Rocky Linux CentOS Debian Ubuntu Shell Script

This project aims to provision Droplets on DigitalOcean with the help of Terraform or OpenTofu.

⚠️ Caution!

DigitalOcean charges you for the use of VMs even if they are in a powered off state and this can cause a huge cost issue for some people. So you can never forget to destroy your instances after some testing.

📌 Before executing:

Note

It is necessary to get credentials for Terraform execution.

  1. Create a DigitalOcean Personal Access Token.

  2. Create an ssh key to be used with DigitalOcean and register it in the administration panel.

  3. We need to get your SSH key fingerprint. Run this command:

ssh-keygen -E md5 -lf ~/.ssh/your-keyname.pub | awk '{print $2}'|cut -d ':' -f2-
  1. Add two variables to your .bashrc or .zshrc file:
export TF_VAR_do_token=<your-personal-access-token>
export TF_VAR_ssh_fingerprint=<your-key-fingerprint>

💻 Usage

  • Clone this repo.
  • By default an Droplet with Debian 12 with s-1vcpu-2gb will be provisioned, if you want another OS or machine, modify the variables.tf files if you wish.
  • Run terraform init, terraform plan -out= name-of-the-plan and terraform apply. At the end, terraform destroy

🔧 cloud-init

You can also apply post-installation scripts to your DigitalOcean Droplets through cloud-init. This project counts as example scripts for nginx provisioning provided by Ansible Galaxy.

You can create your own script and insert it into the content field of the cloud_init.yaml file.

To work with these settings, uncomment line 11 in the instance.tf file.

💾 Remote state

By default this block will be commented. Uncomment if you use it.

DigitalOcean Spaces Object Storage supports S3-compatible applications, so the aws cli is supported for file handling with DigitalOcean and remote states.

  • Create a Spaces Object Storage bucket with your unique name.
  • Browse to API » Spaces Keys » Generate New Key. Get your Access Key and Secret.
  • Install aws cli.
  • Run the command aws configure --profile digitalocean for configuration.
  • When prompted, enter your previously obtained Access Key and Secret. The region and output fields can be left blank.
  • Add the variable below to your .bashrc or .zshrc:
export AWS_PROFILE=digitalocean
  • Uncomment and edit lines 11 and 13 of the main.tf file with the information about your bucket in which it was created.

🤝 Referral

Need fast and affordable cloud hosting? Try @digitalocean using my affiliate link and get free credits to get started:

DigitalOcean Referral Badge

🎁 Sponsoring

If you like this work, give me it a star on GitHub, and consider supporting it buying me a coffee:

PayPal

terra-do's People

Contributors

ciro-mota avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.