A complete reference for every resource available to the DigitalOcean Terraform provider.
DigitalOcean Terraform Provider Reference
Generated on 13 Jan 2026
from Terraform version
v2.72.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_TOKENDIGITALOCEAN_ACCESS_TOKEN
spaces_access_id- (Optional) The access key ID used for Spaces API operations (Defaults to the value of theSPACES_ACCESS_KEY_IDenvironment variable).spaces_secret_key- (Optional) The secret access key used for Spaces API operations (Defaults to the value of theSPACES_SECRET_ACCESS_KEYenvironment variable).api_endpoint- (Optional) This can be used to override the base URL for DigitalOcean API requests (Defaults to the value of theDIGITALOCEAN_API_URLenvironment variable orhttps://api.digitalocean.comif 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_URLenvironment variable orhttps://{{.Region}}.digitaloceanspaces.comif 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_SECONDenvironment variable or0.0if 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_minandhttp_retry_wait_maxarguments (Defaults to the value of theDIGITALOCEAN_HTTP_RETRY_MAXenvironment variable or4if 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_MINenvironment variable or1.0if 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_MAXenvironment variable or30.0if 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.