SpacesBucket

Provides a bucket resource for Spaces, DigitalOcean’s object storage product.

The Spaces API was designed to be interoperable with Amazon’s AWS S3 API. This allows users to interact with the service while using the tools they already know. Spaces mirrors S3’s authentication framework and requests to Spaces require a key pair similar to Amazon’s Access ID and Secret Key.

The authentication requirement can be met by either setting the SPACES_ACCESS_KEY_ID and SPACES_SECRET_ACCESS_KEY environment variables or the provider’s spaces_access_id and spaces_secret_key arguments to the access ID and secret you generate via the DigitalOcean control panel. For example:

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const static_assets = new digitalocean.SpacesBucket("static-assets", {});
// ...
import pulumi
import pulumi_digitalocean as digitalocean

static_assets = digitalocean.SpacesBucket("static-assets")
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
    public MyStack()
    {
        var static_assets = new DigitalOcean.SpacesBucket("static-assets", new DigitalOcean.SpacesBucketArgs
        {
        });
        // ...
    }

}

For more information, See An Introduction to DigitalOcean Spaces

Example Usage

Create a New Bucket

using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
    public MyStack()
    {
        var foobar = new DigitalOcean.SpacesBucket("foobar", new DigitalOcean.SpacesBucketArgs
        {
            Region = "nyc3",
        });
    }

}

Coming soon!

import pulumi
import pulumi_digitalocean as digitalocean

foobar = digitalocean.SpacesBucket("foobar", region="nyc3")
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const foobar = new digitalocean.SpacesBucket("foobar", {
    region: "nyc3",
});

Create a New Bucket With CORS Rules

using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
    public MyStack()
    {
        var foobar = new DigitalOcean.SpacesBucket("foobar", new DigitalOcean.SpacesBucketArgs
        {
            CorsRules = 
            {
                new DigitalOcean.Inputs.SpacesBucketCorsRuleArgs
                {
                    AllowedHeaders = 
                    {
                        "*",
                    },
                    AllowedMethods = 
                    {
                        "GET",
                    },
                    AllowedOrigins = 
                    {
                        "*",
                    },
                    MaxAgeSeconds = 3000,
                },
                new DigitalOcean.Inputs.SpacesBucketCorsRuleArgs
                {
                    AllowedHeaders = 
                    {
                        "*",
                    },
                    AllowedMethods = 
                    {
                        "PUT",
                        "POST",
                        "DELETE",
                    },
                    AllowedOrigins = 
                    {
                        "https://www.example.com",
                    },
                    MaxAgeSeconds = 3000,
                },
            },
            Region = "nyc3",
        });
    }

}

Coming soon!

import pulumi
import pulumi_digitalocean as digitalocean

foobar = digitalocean.SpacesBucket("foobar",
    cors_rules=[
        {
            "allowedHeaders": ["*"],
            "allowedMethods": ["GET"],
            "allowedOrigins": ["*"],
            "maxAgeSeconds": 3000,
        },
        {
            "allowedHeaders": ["*"],
            "allowedMethods": [
                "PUT",
                "POST",
                "DELETE",
            ],
            "allowedOrigins": ["https://www.example.com"],
            "maxAgeSeconds": 3000,
        },
    ],
    region="nyc3")
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const foobar = new digitalocean.SpacesBucket("foobar", {
    corsRules: [
        {
            allowedHeaders: ["*"],
            allowedMethods: ["GET"],
            allowedOrigins: ["*"],
            maxAgeSeconds: 3000,
        },
        {
            allowedHeaders: ["*"],
            allowedMethods: [
                "PUT",
                "POST",
                "DELETE",
            ],
            allowedOrigins: ["https://www.example.com"],
            maxAgeSeconds: 3000,
        },
    ],
    region: "nyc3",
});

Create a SpacesBucket Resource

def SpacesBucket(resource_name, opts=None, acl=None, cors_rules=None, force_destroy=None, lifecycle_rules=None, name=None, region=None, versioning=None, __props__=None);
func NewSpacesBucket(ctx *Context, name string, args *SpacesBucketArgs, opts ...ResourceOption) (*SpacesBucket, error)
public SpacesBucket(string name, SpacesBucketArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args SpacesBucketArgs
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 SpacesBucketArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SpacesBucketArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

SpacesBucket Resource Properties

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

Inputs

The SpacesBucket resource accepts the following input properties:

Acl string

Canned ACL applied on bucket creation (private or public-read)

CorsRules List<Pulumi.DigitalOcean.Inputs.SpacesBucketCorsRuleArgs>

A rule of Cross-Origin Resource Sharing (documented below).

ForceDestroy bool

Unless true, the bucket will only be destroyed if empty (Defaults to false)

LifecycleRules List<Pulumi.DigitalOcean.Inputs.SpacesBucketLifecycleRuleArgs>

A configuration of object lifecycle management (documented below).

Name string

The name of the bucket

Region string

The region where the bucket resides (Defaults to nyc3)

Versioning Pulumi.DigitalOcean.Inputs.SpacesBucketVersioningArgs

A state of versioning (documented below)

Acl string

Canned ACL applied on bucket creation (private or public-read)

CorsRules []SpacesBucketCorsRule

A rule of Cross-Origin Resource Sharing (documented below).

ForceDestroy bool

Unless true, the bucket will only be destroyed if empty (Defaults to false)

LifecycleRules []SpacesBucketLifecycleRule

A configuration of object lifecycle management (documented below).

Name string

The name of the bucket

Region string

The region where the bucket resides (Defaults to nyc3)

Versioning SpacesBucketVersioning

A state of versioning (documented below)

acl string

Canned ACL applied on bucket creation (private or public-read)

corsRules SpacesBucketCorsRule[]

A rule of Cross-Origin Resource Sharing (documented below).

forceDestroy boolean

Unless true, the bucket will only be destroyed if empty (Defaults to false)

lifecycleRules SpacesBucketLifecycleRule[]

A configuration of object lifecycle management (documented below).

name string

The name of the bucket

region Region

The region where the bucket resides (Defaults to nyc3)

versioning SpacesBucketVersioning

A state of versioning (documented below)

acl str

Canned ACL applied on bucket creation (private or public-read)

cors_rules List[SpacesBucketCorsRule]

A rule of Cross-Origin Resource Sharing (documented below).

force_destroy bool

Unless true, the bucket will only be destroyed if empty (Defaults to false)

lifecycle_rules List[SpacesBucketLifecycleRule]

A configuration of object lifecycle management (documented below).

name str

The name of the bucket

region str

The region where the bucket resides (Defaults to nyc3)

versioning Dict[SpacesBucketVersioning]

A state of versioning (documented below)

Outputs

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

BucketDomainName string

The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)

BucketUrn string

The uniform resource name for the bucket

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

The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)

BucketUrn string

The uniform resource name for the bucket

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

The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)

bucketUrn string

The uniform resource name for the bucket

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

The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)

bucket_urn str

The uniform resource name for the bucket

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

Look up an Existing SpacesBucket Resource

Get an existing SpacesBucket 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?: SpacesBucketState, opts?: CustomResourceOptions): SpacesBucket
static get(resource_name, id, opts=None, acl=None, bucket_domain_name=None, bucket_urn=None, cors_rules=None, force_destroy=None, lifecycle_rules=None, name=None, region=None, versioning=None, __props__=None);
func GetSpacesBucket(ctx *Context, name string, id IDInput, state *SpacesBucketState, opts ...ResourceOption) (*SpacesBucket, error)
public static SpacesBucket Get(string name, Input<string> id, SpacesBucketState? 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:

Acl string

Canned ACL applied on bucket creation (private or public-read)

BucketDomainName string

The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)

BucketUrn string

The uniform resource name for the bucket

CorsRules List<Pulumi.DigitalOcean.Inputs.SpacesBucketCorsRuleArgs>

A rule of Cross-Origin Resource Sharing (documented below).

ForceDestroy bool

Unless true, the bucket will only be destroyed if empty (Defaults to false)

LifecycleRules List<Pulumi.DigitalOcean.Inputs.SpacesBucketLifecycleRuleArgs>

A configuration of object lifecycle management (documented below).

Name string

The name of the bucket

Region string

The region where the bucket resides (Defaults to nyc3)

Versioning Pulumi.DigitalOcean.Inputs.SpacesBucketVersioningArgs

A state of versioning (documented below)

Acl string

Canned ACL applied on bucket creation (private or public-read)

BucketDomainName string

The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)

BucketUrn string

The uniform resource name for the bucket

CorsRules []SpacesBucketCorsRule

A rule of Cross-Origin Resource Sharing (documented below).

ForceDestroy bool

Unless true, the bucket will only be destroyed if empty (Defaults to false)

LifecycleRules []SpacesBucketLifecycleRule

A configuration of object lifecycle management (documented below).

Name string

The name of the bucket

Region string

The region where the bucket resides (Defaults to nyc3)

Versioning SpacesBucketVersioning

A state of versioning (documented below)

acl string

Canned ACL applied on bucket creation (private or public-read)

bucketDomainName string

The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)

bucketUrn string

The uniform resource name for the bucket

corsRules SpacesBucketCorsRule[]

A rule of Cross-Origin Resource Sharing (documented below).

forceDestroy boolean

Unless true, the bucket will only be destroyed if empty (Defaults to false)

lifecycleRules SpacesBucketLifecycleRule[]

A configuration of object lifecycle management (documented below).

name string

The name of the bucket

region Region

The region where the bucket resides (Defaults to nyc3)

versioning SpacesBucketVersioning

A state of versioning (documented below)

acl str

Canned ACL applied on bucket creation (private or public-read)

bucket_domain_name str

The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)

bucket_urn str

The uniform resource name for the bucket

cors_rules List[SpacesBucketCorsRule]

A rule of Cross-Origin Resource Sharing (documented below).

force_destroy bool

Unless true, the bucket will only be destroyed if empty (Defaults to false)

lifecycle_rules List[SpacesBucketLifecycleRule]

A configuration of object lifecycle management (documented below).

name str

The name of the bucket

region str

The region where the bucket resides (Defaults to nyc3)

versioning Dict[SpacesBucketVersioning]

A state of versioning (documented below)

Supporting Types

SpacesBucketCorsRule

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

AllowedMethods List<string>

A list of HTTP methods (e.g. GET) which are allowed from the specified origin.

AllowedOrigins List<string>

A list of hosts from which requests using the specified methods are allowed. A host may contain one wildcard (e.g. http://*.example.com).

AllowedHeaders List<string>

A list of headers that will be included in the CORS preflight request’s Access-Control-Request-Headers. A header may contain one wildcard (e.g. x-amz-*).

MaxAgeSeconds int

The time in seconds that browser can cache the response for a preflight request.

AllowedMethods []string

A list of HTTP methods (e.g. GET) which are allowed from the specified origin.

AllowedOrigins []string

A list of hosts from which requests using the specified methods are allowed. A host may contain one wildcard (e.g. http://*.example.com).

AllowedHeaders []string

A list of headers that will be included in the CORS preflight request’s Access-Control-Request-Headers. A header may contain one wildcard (e.g. x-amz-*).

MaxAgeSeconds int

The time in seconds that browser can cache the response for a preflight request.

allowedMethods string[]

A list of HTTP methods (e.g. GET) which are allowed from the specified origin.

allowedOrigins string[]

A list of hosts from which requests using the specified methods are allowed. A host may contain one wildcard (e.g. http://*.example.com).

allowedHeaders string[]

A list of headers that will be included in the CORS preflight request’s Access-Control-Request-Headers. A header may contain one wildcard (e.g. x-amz-*).

maxAgeSeconds number

The time in seconds that browser can cache the response for a preflight request.

allowedMethods List[str]

A list of HTTP methods (e.g. GET) which are allowed from the specified origin.

allowedOrigins List[str]

A list of hosts from which requests using the specified methods are allowed. A host may contain one wildcard (e.g. http://*.example.com).

allowedHeaders List[str]

A list of headers that will be included in the CORS preflight request’s Access-Control-Request-Headers. A header may contain one wildcard (e.g. x-amz-*).

maxAgeSeconds float

The time in seconds that browser can cache the response for a preflight request.

SpacesBucketLifecycleRule

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Enabled bool

Specifies lifecycle rule status.

AbortIncompleteMultipartUploadDays int

Specifies the number of days after initiating a multipart upload when the multipart upload must be completed or else Spaces will abort the upload.

Expiration Pulumi.DigitalOcean.Inputs.SpacesBucketLifecycleRuleExpirationArgs

Specifies a time period after which applicable objects expire (documented below).

Id string

Unique identifier for the rule.

NoncurrentVersionExpiration Pulumi.DigitalOcean.Inputs.SpacesBucketLifecycleRuleNoncurrentVersionExpirationArgs

Specifies when non-current object versions expire (documented below).

Prefix string

Object key prefix identifying one or more objects to which the rule applies.

Enabled bool

Specifies lifecycle rule status.

AbortIncompleteMultipartUploadDays int

Specifies the number of days after initiating a multipart upload when the multipart upload must be completed or else Spaces will abort the upload.

Expiration SpacesBucketLifecycleRuleExpiration

Specifies a time period after which applicable objects expire (documented below).

Id string

Unique identifier for the rule.

NoncurrentVersionExpiration SpacesBucketLifecycleRuleNoncurrentVersionExpiration

Specifies when non-current object versions expire (documented below).

Prefix string

Object key prefix identifying one or more objects to which the rule applies.

enabled boolean

Specifies lifecycle rule status.

abortIncompleteMultipartUploadDays number

Specifies the number of days after initiating a multipart upload when the multipart upload must be completed or else Spaces will abort the upload.

expiration SpacesBucketLifecycleRuleExpiration

Specifies a time period after which applicable objects expire (documented below).

id string

Unique identifier for the rule.

noncurrentVersionExpiration SpacesBucketLifecycleRuleNoncurrentVersionExpiration

Specifies when non-current object versions expire (documented below).

prefix string

Object key prefix identifying one or more objects to which the rule applies.

enabled bool

Specifies lifecycle rule status.

abortIncompleteMultipartUploadDays float

Specifies the number of days after initiating a multipart upload when the multipart upload must be completed or else Spaces will abort the upload.

expiration Dict[SpacesBucketLifecycleRuleExpiration]

Specifies a time period after which applicable objects expire (documented below).

id str

Unique identifier for the rule.

noncurrentVersionExpiration Dict[SpacesBucketLifecycleRuleNoncurrentVersionExpiration]

Specifies when non-current object versions expire (documented below).

prefix str

Object key prefix identifying one or more objects to which the rule applies.

SpacesBucketLifecycleRuleExpiration

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Date string

Specifies the date/time after which you want applicable objects to expire. The argument uses RFC3339 format, e.g. “2020-03-22T15:03:55Z” or parts thereof e.g. “2019-02-28”.

Days int

Specifies the number of days after object creation when the applicable objects will expire.

ExpiredObjectDeleteMarker bool

On a versioned bucket (versioning-enabled or versioning-suspended bucket), setting this to true directs Spaces to delete expired object delete markers.

Date string

Specifies the date/time after which you want applicable objects to expire. The argument uses RFC3339 format, e.g. “2020-03-22T15:03:55Z” or parts thereof e.g. “2019-02-28”.

Days int

Specifies the number of days after object creation when the applicable objects will expire.

ExpiredObjectDeleteMarker bool

On a versioned bucket (versioning-enabled or versioning-suspended bucket), setting this to true directs Spaces to delete expired object delete markers.

date string

Specifies the date/time after which you want applicable objects to expire. The argument uses RFC3339 format, e.g. “2020-03-22T15:03:55Z” or parts thereof e.g. “2019-02-28”.

days number

Specifies the number of days after object creation when the applicable objects will expire.

expiredObjectDeleteMarker boolean

On a versioned bucket (versioning-enabled or versioning-suspended bucket), setting this to true directs Spaces to delete expired object delete markers.

date str

Specifies the date/time after which you want applicable objects to expire. The argument uses RFC3339 format, e.g. “2020-03-22T15:03:55Z” or parts thereof e.g. “2019-02-28”.

days float

Specifies the number of days after object creation when the applicable objects will expire.

expiredObjectDeleteMarker bool

On a versioned bucket (versioning-enabled or versioning-suspended bucket), setting this to true directs Spaces to delete expired object delete markers.

SpacesBucketLifecycleRuleNoncurrentVersionExpiration

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Days int

Specifies the number of days after which an object’s non-current versions expire.

Days int

Specifies the number of days after which an object’s non-current versions expire.

days number

Specifies the number of days after which an object’s non-current versions expire.

days float

Specifies the number of days after which an object’s non-current versions expire.

SpacesBucketVersioning

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Enabled bool

Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state. You can, however, suspend versioning on that bucket.

Enabled bool

Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state. You can, however, suspend versioning on that bucket.

enabled boolean

Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state. You can, however, suspend versioning on that bucket.

enabled bool

Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state. You can, however, suspend versioning on that bucket.

Package Details

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