Spaces Bucket Object Args
Provides a bucket object resource for Spaces, DigitalOcean's object storage product. The digitalocean.SpacesBucketObject
resource allows the provider to upload content to Spaces. 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 System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var static_assets = new DigitalOcean.SpacesBucket("static-assets");
});
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 {
_, err := digitalocean.NewSpacesBucket(ctx, "static-assets", nil)
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 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 static_assets = new SpacesBucket("static-assets");
}
}
resources:
static-assets:
type: digitalocean:SpacesBucket
For more information, See An Introduction to DigitalOcean Spaces
Example Usage
Create a Key in a Spaces Bucket
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const foobar = new digitalocean.SpacesBucket("foobar", {
name: "foobar",
region: digitalocean.Region.NYC3,
});
const index = new digitalocean.SpacesBucketObject("index", {
region: foobar.region,
bucket: foobar.name,
key: "index.html",
content: "<html><body><p>This page is empty.</p></body></html>",
contentType: "text/html",
});
import pulumi
import pulumi_digitalocean as digitalocean
foobar = digitalocean.SpacesBucket("foobar",
name="foobar",
region=digitalocean.Region.NYC3)
index = digitalocean.SpacesBucketObject("index",
region=foobar.region,
bucket=foobar.name,
key="index.html",
content="<html><body><p>This page is empty.</p></body></html>",
content_type="text/html")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var foobar = new DigitalOcean.SpacesBucket("foobar", new()
{
Name = "foobar",
Region = DigitalOcean.Region.NYC3,
});
var index = new DigitalOcean.SpacesBucketObject("index", new()
{
Region = foobar.Region,
Bucket = foobar.Name,
Key = "index.html",
Content = "<html><body><p>This page is empty.</p></body></html>",
ContentType = "text/html",
});
});
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 {
foobar, err := digitalocean.NewSpacesBucket(ctx, "foobar", &digitalocean.SpacesBucketArgs{
Name: pulumi.String("foobar"),
Region: pulumi.String(digitalocean.RegionNYC3),
})
if err != nil {
return err
}
_, err = digitalocean.NewSpacesBucketObject(ctx, "index", &digitalocean.SpacesBucketObjectArgs{
Region: foobar.Region,
Bucket: foobar.Name,
Key: pulumi.String("index.html"),
Content: pulumi.String("<html><body><p>This page is empty.</p></body></html>"),
ContentType: pulumi.String("text/html"),
})
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.SpacesBucketObject;
import com.pulumi.digitalocean.SpacesBucketObjectArgs;
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 foobar = new SpacesBucket("foobar", SpacesBucketArgs.builder()
.name("foobar")
.region("nyc3")
.build());
var index = new SpacesBucketObject("index", SpacesBucketObjectArgs.builder()
.region(foobar.region())
.bucket(foobar.name())
.key("index.html")
.content("<html><body><p>This page is empty.</p></body></html>")
.contentType("text/html")
.build());
}
}
resources:
foobar:
type: digitalocean:SpacesBucket
properties:
name: foobar
region: nyc3
index:
type: digitalocean:SpacesBucketObject
properties:
region: ${foobar.region}
bucket: ${foobar.name}
key: index.html
content: <html><body><p>This page is empty.</p></body></html>
contentType: text/html
Import
Importing this resource is not supported.
Constructors
Properties
Specifies caching behavior along the request/reply chain Read w3c cache_control for further details.
Base64-encoded data that will be decoded and uploaded as raw bytes for the object content. This allows safely uploading non-UTF8 binary data, but is recommended only for small content such as the result of the gzipbase64
function with small text strings. For larger objects, use source
to stream the content from a disk file.
Specifies presentational information for the object. Read w3c content_disposition for further information.
Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. Read w3c content encoding for further information.
The language the content is in e.g. en-US or en-GB.
A standard MIME type describing the format of the object data, e.g. application/octet-stream. All Valid MIME Types are valid for this input.
Allow the object to be deleted by removing any legal hold on any object version. Default is false
. This value should be set to true
only if the bucket has S3 object lock enabled. If no content is provided through source
, content
or content_base64
, then the object will be empty.
Specifies a target URL for website redirect.