DigitalOcean v4.19.3, May 24 23
DigitalOcean v4.19.3, May 24 23
digitalocean.Cdn
Explore with Pulumi AI
Provides a DigitalOcean CDN Endpoint resource for use with Spaces.
Example Usage
Basic Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
// Create a new Spaces Bucket
var mybucket = new DigitalOcean.SpacesBucket("mybucket", new()
{
Region = "sfo2",
Acl = "public-read",
});
// Add a CDN endpoint to the Spaces Bucket
var mycdn = new DigitalOcean.Cdn("mycdn", new()
{
Origin = mybucket.BucketDomainName,
});
return new Dictionary<string, object?>
{
["fqdn"] = mycdn.Endpoint,
};
});
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
mybucket, err := digitalocean.NewSpacesBucket(ctx, "mybucket", &digitalocean.SpacesBucketArgs{
Region: pulumi.String("sfo2"),
Acl: pulumi.String("public-read"),
})
if err != nil {
return err
}
mycdn, err := digitalocean.NewCdn(ctx, "mycdn", &digitalocean.CdnArgs{
Origin: mybucket.BucketDomainName,
})
if err != nil {
return err
}
ctx.Export("fqdn", mycdn.Endpoint)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.SpacesBucket;
import com.pulumi.digitalocean.SpacesBucketArgs;
import com.pulumi.digitalocean.Cdn;
import com.pulumi.digitalocean.CdnArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var mybucket = new SpacesBucket("mybucket", SpacesBucketArgs.builder()
.region("sfo2")
.acl("public-read")
.build());
var mycdn = new Cdn("mycdn", CdnArgs.builder()
.origin(mybucket.bucketDomainName())
.build());
ctx.export("fqdn", mycdn.endpoint());
}
}
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;
resources:
# Create a new Spaces Bucket
mybucket:
type: digitalocean:SpacesBucket
properties:
region: sfo2
acl: public-read
# Add a CDN endpoint to the Spaces Bucket
mycdn:
type: digitalocean:Cdn
properties:
origin: ${mybucket.bucketDomainName}
outputs:
# Output the endpoint for the CDN resource
fqdn: ${mycdn.endpoint}
Custom Sub-Domain Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
// Create a new Spaces Bucket
var mybucket = new DigitalOcean.SpacesBucket("mybucket", new()
{
Region = "sfo2",
Acl = "public-read",
});
// Create a DigitalOcean managed Let's Encrypt Certificate
var cert = new DigitalOcean.Certificate("cert", new()
{
Type = "lets_encrypt",
Domains = new[]
{
"static.example.com",
},
});
// Add a CDN endpoint with a custom sub-domain to the Spaces Bucket
var mycdn = new DigitalOcean.Cdn("mycdn", new()
{
Origin = mybucket.BucketDomainName,
CustomDomain = "static.example.com",
CertificateName = cert.Name,
});
});
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
mybucket, err := digitalocean.NewSpacesBucket(ctx, "mybucket", &digitalocean.SpacesBucketArgs{
Region: pulumi.String("sfo2"),
Acl: pulumi.String("public-read"),
})
if err != nil {
return err
}
cert, err := digitalocean.NewCertificate(ctx, "cert", &digitalocean.CertificateArgs{
Type: pulumi.String("lets_encrypt"),
Domains: pulumi.StringArray{
pulumi.String("static.example.com"),
},
})
if err != nil {
return err
}
_, err = digitalocean.NewCdn(ctx, "mycdn", &digitalocean.CdnArgs{
Origin: mybucket.BucketDomainName,
CustomDomain: pulumi.String("static.example.com"),
CertificateName: cert.Name,
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.SpacesBucket;
import com.pulumi.digitalocean.SpacesBucketArgs;
import com.pulumi.digitalocean.Certificate;
import com.pulumi.digitalocean.CertificateArgs;
import com.pulumi.digitalocean.Cdn;
import com.pulumi.digitalocean.CdnArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var mybucket = new SpacesBucket("mybucket", SpacesBucketArgs.builder()
.region("sfo2")
.acl("public-read")
.build());
var cert = new Certificate("cert", CertificateArgs.builder()
.type("lets_encrypt")
.domains("static.example.com")
.build());
var mycdn = new Cdn("mycdn", CdnArgs.builder()
.origin(mybucket.bucketDomainName())
.customDomain("static.example.com")
.certificateName(cert.name())
.build());
}
}
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_name=cert.name)
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",
certificateName: cert.name,
});
resources:
# Create a new Spaces Bucket
mybucket:
type: digitalocean:SpacesBucket
properties:
region: sfo2
acl: public-read
# Create a DigitalOcean managed Let's Encrypt Certificate
cert:
type: digitalocean:Certificate
properties:
type: lets_encrypt
domains:
- static.example.com
# Add a CDN endpoint with a custom sub-domain to the Spaces Bucket
mycdn:
type: digitalocean:Cdn
properties:
origin: ${mybucket.bucketDomainName}
customDomain: static.example.com
certificateName: ${cert.name}
Create Cdn Resource
new Cdn(name: string, args: CdnArgs, opts?: CustomResourceOptions);
@overload
def Cdn(resource_name: str,
opts: Optional[ResourceOptions] = None,
certificate_id: Optional[str] = None,
certificate_name: Optional[str] = None,
custom_domain: Optional[str] = None,
origin: Optional[str] = None,
ttl: Optional[int] = None)
@overload
def Cdn(resource_name: str,
args: CdnArgs,
opts: Optional[ResourceOptions] = None)
func NewCdn(ctx *Context, name string, args CdnArgs, opts ...ResourceOption) (*Cdn, error)
public Cdn(string name, CdnArgs args, CustomResourceOptions? opts = null)
type: digitalocean:Cdn
properties: # The arguments to resource properties.
options: # 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.
- resource_name str
- The unique name of the resource.
- args CdnArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control 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.
- name String
- The unique name of the resource.
- args CdnArgs
- The arguments to resource properties.
- options 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 Architecture and Concepts docs.
Inputs
The Cdn resource accepts the following input properties:
- Origin string
The fully qualified domain name, (FQDN) for a Space.
- Certificate
Id string Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- Certificate
Name string The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- Custom
Domain 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.
- Certificate
Id string Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- Certificate
Name string The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- Custom
Domain 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.
- certificate
Id String Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- certificate
Name String The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- custom
Domain String The fully qualified domain name (FQDN) of the custom subdomain used with the CDN Endpoint.
- ttl Integer
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.
- certificate
Id string Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- certificate
Name string The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- custom
Domain 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 Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- certificate_
name str The unique name 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 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.
- certificate
Id String Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- certificate
Name String The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- custom
Domain 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.
Outputs
All input properties are implicitly available as output properties. Additionally, the Cdn resource produces the following output properties:
- 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 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
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
certificate_id: Optional[str] = None,
certificate_name: Optional[str] = None,
created_at: Optional[str] = None,
custom_domain: Optional[str] = None,
endpoint: Optional[str] = None,
origin: Optional[str] = None,
ttl: Optional[int] = None) -> Cdn
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)
public static Cdn get(String name, Output<String> id, CdnState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Certificate
Id string Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- Certificate
Name string The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- Created
At string The date and time when the CDN Endpoint was created.
- Custom
Domain 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.
- Certificate
Id string Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- Certificate
Name string The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- Created
At string The date and time when the CDN Endpoint was created.
- Custom
Domain 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.
- certificate
Id String Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- certificate
Name String The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- created
At String The date and time when the CDN Endpoint was created.
- custom
Domain 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 Integer
The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.
- certificate
Id string Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- certificate
Name string The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- created
At string The date and time when the CDN Endpoint was created.
- custom
Domain 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 Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- certificate_
name str The unique name 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 int
The time to live for the CDN Endpoint, in seconds. Default is 3600 seconds.
- certificate
Id String Deprecated The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
Certificate IDs may change, for example when a Let's Encrypt certificate is auto-renewed. Please specify 'certificate_name' instead.
- certificate
Name String The unique name of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- created
At String The date and time when the CDN Endpoint was created.
- custom
Domain 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.
Import
CDN Endpoints can be imported using the CDN id
, e.g.
$ pulumi import digitalocean:index/cdn:Cdn mycdn fb06ad00-351f-45c8-b5eb-13523c438661
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
digitalocean
Terraform Provider.