Cdn

Provides a DigitalOcean CDN Endpoint resource for use with Spaces.

Example Usage

Basic Example

using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new Spaces Bucket
        var mybucket = new DigitalOcean.SpacesBucket("mybucket", new DigitalOcean.SpacesBucketArgs
        {
            Region = "sfo2",
            Acl = "public-read",
        });
        // Add a CDN endpoint to the Spaces Bucket
        var mycdn = new DigitalOcean.Cdn("mycdn", new DigitalOcean.CdnArgs
        {
            Origin = mybucket.BucketDomainName,
        });
        this.Fqdn = mycdn.Endpoint;
    }

    [Output("fqdn")]
    public Output<string> Fqdn { get; set; }
}

Coming soon!

import pulumi
import pulumi_digitalocean as digitalocean

# Create a new Spaces Bucket
mybucket = digitalocean.SpacesBucket("mybucket",
    region="sfo2",
    acl="public-read")
# Add a CDN endpoint to the Spaces Bucket
mycdn = digitalocean.Cdn("mycdn", origin=mybucket.bucket_domain_name)
pulumi.export("fqdn", mycdn.endpoint)
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

// Create a new Spaces Bucket
const mybucket = new digitalocean.SpacesBucket("mybucket", {
    region: "sfo2",
    acl: "public-read",
});
// Add a CDN endpoint to the Spaces Bucket
const mycdn = new digitalocean.Cdn("mycdn", {origin: mybucket.bucketDomainName});
export const fqdn = mycdn.endpoint;

Custom Sub-Domain Example

using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new Spaces Bucket
        var mybucket = new DigitalOcean.SpacesBucket("mybucket", new DigitalOcean.SpacesBucketArgs
        {
            Region = "sfo2",
            Acl = "public-read",
        });
        // Create a DigitalOcean managed Let's Encrypt Certificate
        var cert = new DigitalOcean.Certificate("cert", new DigitalOcean.CertificateArgs
        {
            Type = "lets_encrypt",
            Domains = 
            {
                "static.example.com",
            },
        });
        // Add a CDN endpoint with a custom sub-domain to the Spaces Bucket
        var mycdn = new DigitalOcean.Cdn("mycdn", new DigitalOcean.CdnArgs
        {
            Origin = mybucket.BucketDomainName,
            CustomDomain = "static.example.com",
            CertificateId = cert.Id,
        });
    }

}

Coming soon!

import pulumi
import pulumi_digitalocean as digitalocean

# Create a new Spaces Bucket
mybucket = digitalocean.SpacesBucket("mybucket",
    region="sfo2",
    acl="public-read")
# Create a DigitalOcean managed Let's Encrypt Certificate
cert = digitalocean.Certificate("cert",
    type="lets_encrypt",
    domains=["static.example.com"])
# Add a CDN endpoint with a custom sub-domain to the Spaces Bucket
mycdn = digitalocean.Cdn("mycdn",
    origin=mybucket.bucket_domain_name,
    custom_domain="static.example.com",
    certificate_id=cert.id)
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

// Create a new Spaces Bucket
const mybucket = new digitalocean.SpacesBucket("mybucket", {
    region: "sfo2",
    acl: "public-read",
});
// Create a DigitalOcean managed Let's Encrypt Certificate
const cert = new digitalocean.Certificate("cert", {
    type: "lets_encrypt",
    domains: ["static.example.com"],
});
// Add a CDN endpoint with a custom sub-domain to the Spaces Bucket
const mycdn = new digitalocean.Cdn("mycdn", {
    origin: mybucket.bucketDomainName,
    customDomain: "static.example.com",
    certificateId: cert.id,
});

Create a Cdn Resource

new Cdn(name: string, args: CdnArgs, opts?: CustomResourceOptions);
def Cdn(resource_name, opts=None, certificate_id=None, custom_domain=None, origin=None, ttl=None, __props__=None);
func NewCdn(ctx *Context, name string, args CdnArgs, opts ...ResourceOption) (*Cdn, error)
public Cdn(string name, CdnArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args CdnArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args CdnArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args CdnArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Cdn Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Cdn resource accepts the following input properties:

Origin string

The fully qualified domain name, (FQDN) for a Space.

CertificateId string

The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.

CustomDomain string

The fully qualified domain name (FQDN) of the custom subdomain used with the CDN Endpoint.

Ttl int

The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.

Origin string

The fully qualified domain name, (FQDN) for a Space.

CertificateId string

The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.

CustomDomain string

The fully qualified domain name (FQDN) of the custom subdomain used with the CDN Endpoint.

Ttl int

The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.

origin string

The fully qualified domain name, (FQDN) for a Space.

certificateId string

The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.

customDomain string

The fully qualified domain name (FQDN) of the custom subdomain used with the CDN Endpoint.

ttl number

The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.

origin str

The fully qualified domain name, (FQDN) for a Space.

certificate_id str

The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.

custom_domain str

The fully qualified domain name (FQDN) of the custom subdomain used with the CDN Endpoint.

ttl float

The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.

Outputs

All input properties are implicitly available as output properties. Additionally, the Cdn resource produces the following output properties:

CreatedAt string

The date and time when the CDN Endpoint was created.

Endpoint string

The fully qualified domain name (FQDN) from which the CDN-backed content is served.

Id string
The provider-assigned unique ID for this managed resource.
CreatedAt string

The date and time when the CDN Endpoint was created.

Endpoint string

The fully qualified domain name (FQDN) from which the CDN-backed content is served.

Id string
The provider-assigned unique ID for this managed resource.
createdAt string

The date and time when the CDN Endpoint was created.

endpoint string

The fully qualified domain name (FQDN) from which the CDN-backed content is served.

id string
The provider-assigned unique ID for this managed resource.
created_at str

The date and time when the CDN Endpoint was created.

endpoint str

The fully qualified domain name (FQDN) from which the CDN-backed content is served.

id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Cdn Resource

Get an existing Cdn resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: CdnState, opts?: CustomResourceOptions): Cdn
static get(resource_name, id, opts=None, certificate_id=None, created_at=None, custom_domain=None, endpoint=None, origin=None, ttl=None, __props__=None);
func GetCdn(ctx *Context, name string, id IDInput, state *CdnState, opts ...ResourceOption) (*Cdn, error)
public static Cdn Get(string name, Input<string> id, CdnState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

CertificateId string

The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.

CreatedAt string

The date and time when the CDN Endpoint was created.

CustomDomain string

The fully qualified domain name (FQDN) of the custom subdomain used with the CDN Endpoint.

Endpoint string

The fully qualified domain name (FQDN) from which the CDN-backed content is served.

Origin string

The fully qualified domain name, (FQDN) for a Space.

Ttl int

The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.

CertificateId string

The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.

CreatedAt string

The date and time when the CDN Endpoint was created.

CustomDomain string

The fully qualified domain name (FQDN) of the custom subdomain used with the CDN Endpoint.

Endpoint string

The fully qualified domain name (FQDN) from which the CDN-backed content is served.

Origin string

The fully qualified domain name, (FQDN) for a Space.

Ttl int

The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.

certificateId string

The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.

createdAt string

The date and time when the CDN Endpoint was created.

customDomain string

The fully qualified domain name (FQDN) of the custom subdomain used with the CDN Endpoint.

endpoint string

The fully qualified domain name (FQDN) from which the CDN-backed content is served.

origin string

The fully qualified domain name, (FQDN) for a Space.

ttl number

The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.

certificate_id str

The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.

created_at str

The date and time when the CDN Endpoint was created.

custom_domain str

The fully qualified domain name (FQDN) of the custom subdomain used with the CDN Endpoint.

endpoint str

The fully qualified domain name (FQDN) from which the CDN-backed content is served.

origin str

The fully qualified domain name, (FQDN) for a Space.

ttl float

The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.

Package Details

Repository
https://github.com/pulumi/pulumi-digitalocean
License
Apache-2.0
Notes
This Pulumi package is based on the digitalocean Terraform Provider.