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
new SpacesBucket(name: string, args?: SpacesBucketArgs, opts?: CustomResourceOptions);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 (
privateorpublic-read)- Cors
Rules List<Pulumi.Digital Ocean. Inputs. Spaces Bucket Cors Rule Args> A rule of Cross-Origin Resource Sharing (documented below).
- Force
Destroy bool Unless
true, the bucket will only be destroyed if empty (Defaults tofalse)- Lifecycle
Rules List<Pulumi.Digital Ocean. Inputs. Spaces Bucket Lifecycle Rule Args> 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.
Digital Ocean. Inputs. Spaces Bucket Versioning Args A state of versioning (documented below)
- Acl string
Canned ACL applied on bucket creation (
privateorpublic-read)- Cors
Rules []SpacesBucket Cors Rule A rule of Cross-Origin Resource Sharing (documented below).
- Force
Destroy bool Unless
true, the bucket will only be destroyed if empty (Defaults tofalse)- Lifecycle
Rules []SpacesBucket Lifecycle Rule 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
Spaces
Bucket Versioning A state of versioning (documented below)
- acl string
Canned ACL applied on bucket creation (
privateorpublic-read)- cors
Rules SpacesBucket Cors Rule[] A rule of Cross-Origin Resource Sharing (documented below).
- force
Destroy boolean Unless
true, the bucket will only be destroyed if empty (Defaults tofalse)- lifecycle
Rules SpacesBucket Lifecycle Rule[] 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
Spaces
Bucket Versioning A state of versioning (documented below)
- acl str
Canned ACL applied on bucket creation (
privateorpublic-read)- cors_
rules List[SpacesBucket Cors Rule] A rule of Cross-Origin Resource Sharing (documented below).
- force_
destroy bool Unless
true, the bucket will only be destroyed if empty (Defaults tofalse)- lifecycle_
rules List[SpacesBucket Lifecycle Rule] 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[Spaces
Bucket Versioning] 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:
- bucket_
domain_ strname 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): SpacesBucketstatic 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 (
privateorpublic-read)- Bucket
Domain stringName The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
- Bucket
Urn string The uniform resource name for the bucket
- Cors
Rules List<Pulumi.Digital Ocean. Inputs. Spaces Bucket Cors Rule Args> A rule of Cross-Origin Resource Sharing (documented below).
- Force
Destroy bool Unless
true, the bucket will only be destroyed if empty (Defaults tofalse)- Lifecycle
Rules List<Pulumi.Digital Ocean. Inputs. Spaces Bucket Lifecycle Rule Args> 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.
Digital Ocean. Inputs. Spaces Bucket Versioning Args A state of versioning (documented below)
- Acl string
Canned ACL applied on bucket creation (
privateorpublic-read)- Bucket
Domain stringName The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
- Bucket
Urn string The uniform resource name for the bucket
- Cors
Rules []SpacesBucket Cors Rule A rule of Cross-Origin Resource Sharing (documented below).
- Force
Destroy bool Unless
true, the bucket will only be destroyed if empty (Defaults tofalse)- Lifecycle
Rules []SpacesBucket Lifecycle Rule 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
Spaces
Bucket Versioning A state of versioning (documented below)
- acl string
Canned ACL applied on bucket creation (
privateorpublic-read)- bucket
Domain stringName The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)
- bucket
Urn string The uniform resource name for the bucket
- cors
Rules SpacesBucket Cors Rule[] A rule of Cross-Origin Resource Sharing (documented below).
- force
Destroy boolean Unless
true, the bucket will only be destroyed if empty (Defaults tofalse)- lifecycle
Rules SpacesBucket Lifecycle Rule[] 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
Spaces
Bucket Versioning A state of versioning (documented below)
- acl str
Canned ACL applied on bucket creation (
privateorpublic-read)- bucket_
domain_ strname 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[SpacesBucket Cors Rule] A rule of Cross-Origin Resource Sharing (documented below).
- force_
destroy bool Unless
true, the bucket will only be destroyed if empty (Defaults tofalse)- lifecycle_
rules List[SpacesBucket Lifecycle Rule] 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[Spaces
Bucket Versioning] A state of versioning (documented below)
Supporting Types
SpacesBucketCorsRule
- Allowed
Methods List<string> A list of HTTP methods (e.g.
GET) which are allowed from the specified origin.- Allowed
Origins 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).
- Allowed
Headers 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-*).- Max
Age intSeconds The time in seconds that browser can cache the response for a preflight request.
- Allowed
Methods []string A list of HTTP methods (e.g.
GET) which are allowed from the specified origin.- Allowed
Origins []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).
- Allowed
Headers []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-*).- Max
Age intSeconds The time in seconds that browser can cache the response for a preflight request.
- allowed
Methods string[] A list of HTTP methods (e.g.
GET) which are allowed from the specified origin.- allowed
Origins 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).
- allowed
Headers 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-*).- max
Age numberSeconds The time in seconds that browser can cache the response for a preflight request.
- allowed
Methods List[str] A list of HTTP methods (e.g.
GET) which are allowed from the specified origin.- allowed
Origins 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).
- allowed
Headers 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-*).- max
Age floatSeconds The time in seconds that browser can cache the response for a preflight request.
SpacesBucketLifecycleRule
- Enabled bool
Specifies lifecycle rule status.
- Abort
Incomplete intMultipart Upload Days 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.
Digital Ocean. Inputs. Spaces Bucket Lifecycle Rule Expiration Args Specifies a time period after which applicable objects expire (documented below).
- Id string
Unique identifier for the rule.
- Noncurrent
Version Pulumi.Expiration Digital Ocean. Inputs. Spaces Bucket Lifecycle Rule Noncurrent Version Expiration Args 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.
- Abort
Incomplete intMultipart Upload Days 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
Spaces
Bucket Lifecycle Rule Expiration Specifies a time period after which applicable objects expire (documented below).
- Id string
Unique identifier for the rule.
- Noncurrent
Version SpacesExpiration Bucket Lifecycle Rule Noncurrent Version Expiration 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.
- abort
Incomplete numberMultipart Upload Days 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
Spaces
Bucket Lifecycle Rule Expiration Specifies a time period after which applicable objects expire (documented below).
- id string
Unique identifier for the rule.
- noncurrent
Version SpacesExpiration Bucket Lifecycle Rule Noncurrent Version Expiration 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.
- abort
Incomplete floatMultipart Upload Days 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[Spaces
Bucket Lifecycle Rule Expiration] Specifies a time period after which applicable objects expire (documented below).
- id str
Unique identifier for the rule.
- noncurrent
Version Dict[SpacesExpiration Bucket Lifecycle Rule Noncurrent Version Expiration] 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
- 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.
- Expired
Object boolDelete Marker 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.
- Expired
Object boolDelete Marker 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.
- expired
Object booleanDelete Marker 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.
- expired
Object boolDelete Marker On a versioned bucket (versioning-enabled or versioning-suspended bucket), setting this to true directs Spaces to delete expired object delete markers.
SpacesBucketLifecycleRuleNoncurrentVersionExpiration
SpacesBucketVersioning
Package Details
- Repository
- https://github.com/pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitaloceanTerraform Provider.