1. Packages
  2. Minio Provider
  3. API Docs
  4. S3Object
MinIO v0.16.3 published on Wednesday, Feb 12, 2025 by Pulumi

minio.S3Object

Explore with Pulumi AI

Example Usage

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

const stateTerraformS3 = new minio.S3Bucket("state_terraform_s3", {
    bucket: "state-terraform-s3",
    acl: "public",
});
const txtFile = new minio.S3Object("txt_file", {
    bucketName: stateTerraformS3.bucket,
    objectName: "text.txt",
    content: "Lorem ipsum dolor sit amet.",
    contentType: "text/plain",
}, {
    dependsOn: [stateTerraformS3],
});
export const minioId = txtFile.id;
Copy
import pulumi
import pulumi_minio as minio

state_terraform_s3 = minio.S3Bucket("state_terraform_s3",
    bucket="state-terraform-s3",
    acl="public")
txt_file = minio.S3Object("txt_file",
    bucket_name=state_terraform_s3.bucket,
    object_name="text.txt",
    content="Lorem ipsum dolor sit amet.",
    content_type="text/plain",
    opts = pulumi.ResourceOptions(depends_on=[state_terraform_s3]))
pulumi.export("minioId", txt_file.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-minio/sdk/go/minio"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		stateTerraformS3, err := minio.NewS3Bucket(ctx, "state_terraform_s3", &minio.S3BucketArgs{
			Bucket: pulumi.String("state-terraform-s3"),
			Acl:    pulumi.String("public"),
		})
		if err != nil {
			return err
		}
		txtFile, err := minio.NewS3Object(ctx, "txt_file", &minio.S3ObjectArgs{
			BucketName:  stateTerraformS3.Bucket,
			ObjectName:  pulumi.String("text.txt"),
			Content:     pulumi.String("Lorem ipsum dolor sit amet."),
			ContentType: pulumi.String("text/plain"),
		}, pulumi.DependsOn([]pulumi.Resource{
			stateTerraformS3,
		}))
		if err != nil {
			return err
		}
		ctx.Export("minioId", txtFile.ID())
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Minio = Pulumi.Minio;

return await Deployment.RunAsync(() => 
{
    var stateTerraformS3 = new Minio.S3Bucket("state_terraform_s3", new()
    {
        Bucket = "state-terraform-s3",
        Acl = "public",
    });

    var txtFile = new Minio.S3Object("txt_file", new()
    {
        BucketName = stateTerraformS3.Bucket,
        ObjectName = "text.txt",
        Content = "Lorem ipsum dolor sit amet.",
        ContentType = "text/plain",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            stateTerraformS3,
        },
    });

    return new Dictionary<string, object?>
    {
        ["minioId"] = txtFile.Id,
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.minio.S3Bucket;
import com.pulumi.minio.S3BucketArgs;
import com.pulumi.minio.S3Object;
import com.pulumi.minio.S3ObjectArgs;
import com.pulumi.resources.CustomResourceOptions;
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 stateTerraformS3 = new S3Bucket("stateTerraformS3", S3BucketArgs.builder()
            .bucket("state-terraform-s3")
            .acl("public")
            .build());

        var txtFile = new S3Object("txtFile", S3ObjectArgs.builder()
            .bucketName(stateTerraformS3.bucket())
            .objectName("text.txt")
            .content("Lorem ipsum dolor sit amet.")
            .contentType("text/plain")
            .build(), CustomResourceOptions.builder()
                .dependsOn(stateTerraformS3)
                .build());

        ctx.export("minioId", txtFile.id());
    }
}
Copy
resources:
  stateTerraformS3:
    type: minio:S3Bucket
    name: state_terraform_s3
    properties:
      bucket: state-terraform-s3
      acl: public
  txtFile:
    type: minio:S3Object
    name: txt_file
    properties:
      bucketName: ${stateTerraformS3.bucket}
      objectName: text.txt
      content: Lorem ipsum dolor sit amet.
      contentType: text/plain
    options:
      dependsOn:
        - ${stateTerraformS3}
outputs:
  minioId: ${txtFile.id}
Copy

Create S3Object Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new S3Object(name: string, args: S3ObjectArgs, opts?: CustomResourceOptions);
@overload
def S3Object(resource_name: str,
             args: S3ObjectArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def S3Object(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             bucket_name: Optional[str] = None,
             object_name: Optional[str] = None,
             content: Optional[str] = None,
             content_base64: Optional[str] = None,
             content_type: Optional[str] = None,
             etag: Optional[str] = None,
             source: Optional[str] = None,
             version_id: Optional[str] = None)
func NewS3Object(ctx *Context, name string, args S3ObjectArgs, opts ...ResourceOption) (*S3Object, error)
public S3Object(string name, S3ObjectArgs args, CustomResourceOptions? opts = null)
public S3Object(String name, S3ObjectArgs args)
public S3Object(String name, S3ObjectArgs args, CustomResourceOptions options)
type: minio:S3Object
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. S3ObjectArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. S3ObjectArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. S3ObjectArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. S3ObjectArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. S3ObjectArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var s3objectResource = new Minio.S3Object("s3objectResource", new()
{
    BucketName = "string",
    ObjectName = "string",
    Content = "string",
    ContentBase64 = "string",
    ContentType = "string",
    Etag = "string",
    Source = "string",
    VersionId = "string",
});
Copy
example, err := minio.NewS3Object(ctx, "s3objectResource", &minio.S3ObjectArgs{
	BucketName:    pulumi.String("string"),
	ObjectName:    pulumi.String("string"),
	Content:       pulumi.String("string"),
	ContentBase64: pulumi.String("string"),
	ContentType:   pulumi.String("string"),
	Etag:          pulumi.String("string"),
	Source:        pulumi.String("string"),
	VersionId:     pulumi.String("string"),
})
Copy
var s3objectResource = new S3Object("s3objectResource", S3ObjectArgs.builder()
    .bucketName("string")
    .objectName("string")
    .content("string")
    .contentBase64("string")
    .contentType("string")
    .etag("string")
    .source("string")
    .versionId("string")
    .build());
Copy
s3object_resource = minio.S3Object("s3objectResource",
    bucket_name="string",
    object_name="string",
    content="string",
    content_base64="string",
    content_type="string",
    etag="string",
    source="string",
    version_id="string")
Copy
const s3objectResource = new minio.S3Object("s3objectResource", {
    bucketName: "string",
    objectName: "string",
    content: "string",
    contentBase64: "string",
    contentType: "string",
    etag: "string",
    source: "string",
    versionId: "string",
});
Copy
type: minio:S3Object
properties:
    bucketName: string
    content: string
    contentBase64: string
    contentType: string
    etag: string
    objectName: string
    source: string
    versionId: string
Copy

S3Object Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The S3Object resource accepts the following input properties:

BucketName
This property is required.
Changes to this property will trigger replacement.
string
ObjectName
This property is required.
Changes to this property will trigger replacement.
string
Content string
ContentBase64 string
ContentType string
Etag string
Source string
VersionId string
BucketName
This property is required.
Changes to this property will trigger replacement.
string
ObjectName
This property is required.
Changes to this property will trigger replacement.
string
Content string
ContentBase64 string
ContentType string
Etag string
Source string
VersionId string
bucketName
This property is required.
Changes to this property will trigger replacement.
String
objectName
This property is required.
Changes to this property will trigger replacement.
String
content String
contentBase64 String
contentType String
etag String
source String
versionId String
bucketName
This property is required.
Changes to this property will trigger replacement.
string
objectName
This property is required.
Changes to this property will trigger replacement.
string
content string
contentBase64 string
contentType string
etag string
source string
versionId string
bucket_name
This property is required.
Changes to this property will trigger replacement.
str
object_name
This property is required.
Changes to this property will trigger replacement.
str
content str
content_base64 str
content_type str
etag str
source str
version_id str
bucketName
This property is required.
Changes to this property will trigger replacement.
String
objectName
This property is required.
Changes to this property will trigger replacement.
String
content String
contentBase64 String
contentType String
etag String
source String
versionId String

Outputs

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

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

Look up Existing S3Object Resource

Get an existing S3Object 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?: S3ObjectState, opts?: CustomResourceOptions): S3Object
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bucket_name: Optional[str] = None,
        content: Optional[str] = None,
        content_base64: Optional[str] = None,
        content_type: Optional[str] = None,
        etag: Optional[str] = None,
        object_name: Optional[str] = None,
        source: Optional[str] = None,
        version_id: Optional[str] = None) -> S3Object
func GetS3Object(ctx *Context, name string, id IDInput, state *S3ObjectState, opts ...ResourceOption) (*S3Object, error)
public static S3Object Get(string name, Input<string> id, S3ObjectState? state, CustomResourceOptions? opts = null)
public static S3Object get(String name, Output<String> id, S3ObjectState state, CustomResourceOptions options)
resources:  _:    type: minio:S3Object    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
BucketName Changes to this property will trigger replacement. string
Content string
ContentBase64 string
ContentType string
Etag string
ObjectName Changes to this property will trigger replacement. string
Source string
VersionId string
BucketName Changes to this property will trigger replacement. string
Content string
ContentBase64 string
ContentType string
Etag string
ObjectName Changes to this property will trigger replacement. string
Source string
VersionId string
bucketName Changes to this property will trigger replacement. String
content String
contentBase64 String
contentType String
etag String
objectName Changes to this property will trigger replacement. String
source String
versionId String
bucketName Changes to this property will trigger replacement. string
content string
contentBase64 string
contentType string
etag string
objectName Changes to this property will trigger replacement. string
source string
versionId string
bucket_name Changes to this property will trigger replacement. str
content str
content_base64 str
content_type str
etag str
object_name Changes to this property will trigger replacement. str
source str
version_id str
bucketName Changes to this property will trigger replacement. String
content String
contentBase64 String
contentType String
etag String
objectName Changes to this property will trigger replacement. String
source String
versionId String

Package Details

Repository
MinIO pulumi/pulumi-minio
License
Apache-2.0
Notes
This Pulumi package is based on the minio Terraform Provider.