This Terraform project simplifies the process of setting up a DigitalOcean droplet by leveraging the power of Terraform. It provides a well-organized approach to provisioning resources, making it easier for users to automate the deployment process.
Resource: digitalocean_droplet.instance
Purpose: Creates a DigitalOcean droplet based on specified configurations, including image, region, size, and name.
DigitalOcean Account: You need an active DigitalOcean account to create and manage the droplet.
Terraform Installed: Ensure Terraform is installed on your local machine.
DigitalOcean API Token: Obtain a DigitalOcean API token and set it in the digitalocean_token variable.
- Clone the Repository
git clone https://github.com/cyou-b/terraform-staticsite.git
cd terraform-staticsite
- Configure main (Optional)
- Configure main.tf if want to configure a S3 bucket backend to store terraform config.
- Set Terraform Variables
create tfvars file with data
# terraform.tfvars
digitalocean_token = "YOUR_DIGITALOCEAN_API_TOKEN"
droplet_image = "ubuntu-22-04-x64"
droplet_name = "your-droplet-name"
droplet_region = "nyc1"
droplet_size = "s-1vcpu-1gb"
- Initialize Terraform
terraform init
- Review Terraform Plan
terraform plan --var-file terraform.tfvars
- Apply Terraform Changes
terraform apply --var-file terraform.tfvars
After apply changes, will be necessary add DNS nameservers to you domain
- Cleanup (Optional)
terraform destroy
This project is licensed under the [License Name] License - see the LICENSE.md file for details.