[ Web Proxy ]
URL:
Viewing: https://docs.digitalocean.com/reference/terraform/reference/resources/cdn/ [Back]  [Original]

digitalocean_cdn | DigitalOcean Documentation

For AI agents: The documentation index is at https://docs.digitalocean.com/llms.txt. Markdown versions of pages use the same URL with index.html.md in place of the HTML page (for example, append index.html.md to the directory path instead of opening the HTML document).

digitalocean_cdn

Generated on 18 Aug 2026 from Terraform version v2.100.0

Copy page as Markdown View page as Markdown

Provides a DigitalOcean CDN Endpoint resource for use with Spaces.

Example Usage

Basic Example

# Create a new Spaces Bucket
resource "digitalocean_spaces_bucket" "mybucket" {
  name   = "example"
  region = "sfo2"
  acl    = "public-read"
}

# Add a CDN endpoint to the Spaces Bucket
resource "digitalocean_cdn" "mycdn" {
  origin = digitalocean_spaces_bucket.mybucket.bucket_domain_name
}

# Output the endpoint for the CDN resource
output "fqdn" {
  value = digitalocean_cdn.mycdn.endpoint
}

Custom Sub-Domain Example

# Create a new Spaces Bucket
resource "digitalocean_spaces_bucket" "mybucket" {
  name   = "example"
  region = "sfo2"
  acl    = "public-read"
}

# Create a DigitalOcean managed Let's Encrypt Certificate
resource "digitalocean_certificate" "cert" {
  name    = "cdn-cert"
  type    = "lets_encrypt"
  domains = ["static.example.com"]
}

# Add a CDN endpoint with a custom sub-domain to the Spaces Bucket
resource "digitalocean_cdn" "mycdn" {
  origin           = digitalocean_spaces_bucket.mybucket.bucket_domain_name
  custom_domain    = "static.example.com"
  certificate_name = digitalocean_certificate.cert.name
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Import

CDN Endpoints can be imported using the CDN id, e.g.

terraform import digitalocean_cdn.mycdn fb06ad00-351f-45c8-b5eb-13523c438661

In this article...


We can't find any results for your search.

Try using different keywords or simplifying your search terms.


Web Proxy Viewer  |  New URL  |  Original Page