A complete reference for every resource available to the DigitalOcean Terraform provider.
DigitalOcean Terraform Provider Reference
Generated on 8 May 2025
from Terraform version
v2.53.0
The DigitalOcean Terraform provider is used to interact with the resources supported by DigitalOcean. The provider needs to be configured with the proper credentials before it can be used.
For a step-by-step guide to installing and configuring Terraform, please see How to Configure Terraform for DigitalOcean.
Example Usage
terraform {
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = "~> 2.0"
}
}
}
# Set the variable value in *.tfvars file
# or using -var="do_token=..." CLI option
variable "do_token" {}
# Configure the DigitalOcean Provider
provider "digitalocean" {
token = var.do_token
}
# Create a web server
resource "digitalocean_droplet" "web" {
# ...
}
Argument Reference
The following arguments are supported:
token
- (Required) This is the DO API token. Alternatively, this can also be specified using environment variables ordered by precedence:DIGITALOCEAN_TOKEN
DIGITALOCEAN_ACCESS_TOKEN
spaces_access_id
- (Optional) The access key ID used for Spaces API operations (Defaults to the value of theSPACES_ACCESS_KEY_ID
environment variable).spaces_secret_key
- (Optional) The secret access key used for Spaces API operations (Defaults to the value of theSPACES_SECRET_ACCESS_KEY
environment variable).api_endpoint
- (Optional) This can be used to override the base URL for DigitalOcean API requests (Defaults to the value of theDIGITALOCEAN_API_URL
environment variable orhttps://api.digitalocean.com
if unset).spaces_endpoint
- (Optional) This can be used to override the endpoint URL used for DigitalOcean Spaces requests. (It defaults to the value of theSPACES_ENDPOINT_URL
environment variable orhttps://{{.Region}}.digitaloceanspaces.com
if unset.) The provider will replace{{.Region}}
(via Go’s templating engine) with the slug of the applicable Spaces region.requests_per_second
- (Optional) This can be used to enable throttling, overriding the limit of API calls per second to avoid rate limit errors, can be disabled by setting the value to0.0
(Defaults to the value of theDIGITALOCEAN_REQUESTS_PER_SECOND
environment variable or0.0
if unset).http_retry_max
- (Optional) This can be used to override the maximum number of retries on a failed API request (client errors, 429, 500, 502…), the exponential backoff can be configured by thehttp_retry_wait_min
andhttp_retry_wait_max
arguments (Defaults to the value of theDIGITALOCEAN_HTTP_RETRY_MAX
environment variable or4
if unset).http_retry_wait_min
- (Optional) This can be used to configure the minimum waiting time (in seconds) between failed requests for the backoff strategy (Defaults to the value of theDIGITALOCEAN_HTTP_RETRY_WAIT_MIN
environment variable or1.0
if unset).http_retry_wait_max
- (Optional) This can be used to configure the maximum waiting time (in seconds) between failed requests for the backoff strategy (Defaults to the value of theDIGITALOCEAN_HTTP_RETRY_WAIT_MAX
environment variable or30.0
if unset).
Resources and Data Sources
The following resources and data sources are available:
A complete reference for every data source available to the DigitalOcean Terraform provider.