Inventory

class Inventory : KotlinCustomResource

Provides a S3 bucket inventory configuration resource.

This resource cannot be used with S3 directory buckets.

Example Usage

Add inventory configuration

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.s3.BucketV2("test", {bucket: "my-tf-test-bucket"});
const inventory = new aws.s3.BucketV2("inventory", {bucket: "my-tf-inventory-bucket"});
const testInventory = new aws.s3.Inventory("test", {
bucket: test.id,
name: "EntireBucketDaily",
includedObjectVersions: "All",
schedule: {
frequency: "Daily",
},
destination: {
bucket: {
format: "ORC",
bucketArn: inventory.arn,
},
},
});
import pulumi
import pulumi_aws as aws
test = aws.s3.BucketV2("test", bucket="my-tf-test-bucket")
inventory = aws.s3.BucketV2("inventory", bucket="my-tf-inventory-bucket")
test_inventory = aws.s3.Inventory("test",
bucket=test.id,
name="EntireBucketDaily",
included_object_versions="All",
schedule={
"frequency": "Daily",
},
destination={
"bucket": {
"format": "ORC",
"bucket_arn": inventory.arn,
},
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.S3.BucketV2("test", new()
{
Bucket = "my-tf-test-bucket",
});
var inventory = new Aws.S3.BucketV2("inventory", new()
{
Bucket = "my-tf-inventory-bucket",
});
var testInventory = new Aws.S3.Inventory("test", new()
{
Bucket = test.Id,
Name = "EntireBucketDaily",
IncludedObjectVersions = "All",
Schedule = new Aws.S3.Inputs.InventoryScheduleArgs
{
Frequency = "Daily",
},
Destination = new Aws.S3.Inputs.InventoryDestinationArgs
{
Bucket = new Aws.S3.Inputs.InventoryDestinationBucketArgs
{
Format = "ORC",
BucketArn = inventory.Arn,
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := s3.NewBucketV2(ctx, "test", &s3.BucketV2Args{
Bucket: pulumi.String("my-tf-test-bucket"),
})
if err != nil {
return err
}
inventory, err := s3.NewBucketV2(ctx, "inventory", &s3.BucketV2Args{
Bucket: pulumi.String("my-tf-inventory-bucket"),
})
if err != nil {
return err
}
_, err = s3.NewInventory(ctx, "test", &s3.InventoryArgs{
Bucket: test.ID(),
Name: pulumi.String("EntireBucketDaily"),
IncludedObjectVersions: pulumi.String("All"),
Schedule: &s3.InventoryScheduleArgs{
Frequency: pulumi.String("Daily"),
},
Destination: &s3.InventoryDestinationArgs{
Bucket: &s3.InventoryDestinationBucketArgs{
Format: pulumi.String("ORC"),
BucketArn: inventory.Arn,
},
},
})
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.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketV2Args;
import com.pulumi.aws.s3.Inventory;
import com.pulumi.aws.s3.InventoryArgs;
import com.pulumi.aws.s3.inputs.InventoryScheduleArgs;
import com.pulumi.aws.s3.inputs.InventoryDestinationArgs;
import com.pulumi.aws.s3.inputs.InventoryDestinationBucketArgs;
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 test = new BucketV2("test", BucketV2Args.builder()
.bucket("my-tf-test-bucket")
.build());
var inventory = new BucketV2("inventory", BucketV2Args.builder()
.bucket("my-tf-inventory-bucket")
.build());
var testInventory = new Inventory("testInventory", InventoryArgs.builder()
.bucket(test.id())
.name("EntireBucketDaily")
.includedObjectVersions("All")
.schedule(InventoryScheduleArgs.builder()
.frequency("Daily")
.build())
.destination(InventoryDestinationArgs.builder()
.bucket(InventoryDestinationBucketArgs.builder()
.format("ORC")
.bucketArn(inventory.arn())
.build())
.build())
.build());
}
}
resources:
test:
type: aws:s3:BucketV2
properties:
bucket: my-tf-test-bucket
inventory:
type: aws:s3:BucketV2
properties:
bucket: my-tf-inventory-bucket
testInventory:
type: aws:s3:Inventory
name: test
properties:
bucket: ${test.id}
name: EntireBucketDaily
includedObjectVersions: All
schedule:
frequency: Daily
destination:
bucket:
format: ORC
bucketArn: ${inventory.arn}

Add inventory configuration with S3 object prefix

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.s3.BucketV2("test", {bucket: "my-tf-test-bucket"});
const inventory = new aws.s3.BucketV2("inventory", {bucket: "my-tf-inventory-bucket"});
const test_prefix = new aws.s3.Inventory("test-prefix", {
bucket: test.id,
name: "DocumentsWeekly",
includedObjectVersions: "All",
schedule: {
frequency: "Daily",
},
filter: {
prefix: "documents/",
},
destination: {
bucket: {
format: "ORC",
bucketArn: inventory.arn,
prefix: "inventory",
},
},
});
import pulumi
import pulumi_aws as aws
test = aws.s3.BucketV2("test", bucket="my-tf-test-bucket")
inventory = aws.s3.BucketV2("inventory", bucket="my-tf-inventory-bucket")
test_prefix = aws.s3.Inventory("test-prefix",
bucket=test.id,
name="DocumentsWeekly",
included_object_versions="All",
schedule={
"frequency": "Daily",
},
filter={
"prefix": "documents/",
},
destination={
"bucket": {
"format": "ORC",
"bucket_arn": inventory.arn,
"prefix": "inventory",
},
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.S3.BucketV2("test", new()
{
Bucket = "my-tf-test-bucket",
});
var inventory = new Aws.S3.BucketV2("inventory", new()
{
Bucket = "my-tf-inventory-bucket",
});
var test_prefix = new Aws.S3.Inventory("test-prefix", new()
{
Bucket = test.Id,
Name = "DocumentsWeekly",
IncludedObjectVersions = "All",
Schedule = new Aws.S3.Inputs.InventoryScheduleArgs
{
Frequency = "Daily",
},
Filter = new Aws.S3.Inputs.InventoryFilterArgs
{
Prefix = "documents/",
},
Destination = new Aws.S3.Inputs.InventoryDestinationArgs
{
Bucket = new Aws.S3.Inputs.InventoryDestinationBucketArgs
{
Format = "ORC",
BucketArn = inventory.Arn,
Prefix = "inventory",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := s3.NewBucketV2(ctx, "test", &s3.BucketV2Args{
Bucket: pulumi.String("my-tf-test-bucket"),
})
if err != nil {
return err
}
inventory, err := s3.NewBucketV2(ctx, "inventory", &s3.BucketV2Args{
Bucket: pulumi.String("my-tf-inventory-bucket"),
})
if err != nil {
return err
}
_, err = s3.NewInventory(ctx, "test-prefix", &s3.InventoryArgs{
Bucket: test.ID(),
Name: pulumi.String("DocumentsWeekly"),
IncludedObjectVersions: pulumi.String("All"),
Schedule: &s3.InventoryScheduleArgs{
Frequency: pulumi.String("Daily"),
},
Filter: &s3.InventoryFilterArgs{
Prefix: pulumi.String("documents/"),
},
Destination: &s3.InventoryDestinationArgs{
Bucket: &s3.InventoryDestinationBucketArgs{
Format: pulumi.String("ORC"),
BucketArn: inventory.Arn,
Prefix: pulumi.String("inventory"),
},
},
})
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.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketV2Args;
import com.pulumi.aws.s3.Inventory;
import com.pulumi.aws.s3.InventoryArgs;
import com.pulumi.aws.s3.inputs.InventoryScheduleArgs;
import com.pulumi.aws.s3.inputs.InventoryFilterArgs;
import com.pulumi.aws.s3.inputs.InventoryDestinationArgs;
import com.pulumi.aws.s3.inputs.InventoryDestinationBucketArgs;
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 test = new BucketV2("test", BucketV2Args.builder()
.bucket("my-tf-test-bucket")
.build());
var inventory = new BucketV2("inventory", BucketV2Args.builder()
.bucket("my-tf-inventory-bucket")
.build());
var test_prefix = new Inventory("test-prefix", InventoryArgs.builder()
.bucket(test.id())
.name("DocumentsWeekly")
.includedObjectVersions("All")
.schedule(InventoryScheduleArgs.builder()
.frequency("Daily")
.build())
.filter(InventoryFilterArgs.builder()
.prefix("documents/")
.build())
.destination(InventoryDestinationArgs.builder()
.bucket(InventoryDestinationBucketArgs.builder()
.format("ORC")
.bucketArn(inventory.arn())
.prefix("inventory")
.build())
.build())
.build());
}
}
resources:
test:
type: aws:s3:BucketV2
properties:
bucket: my-tf-test-bucket
inventory:
type: aws:s3:BucketV2
properties:
bucket: my-tf-inventory-bucket
test-prefix:
type: aws:s3:Inventory
properties:
bucket: ${test.id}
name: DocumentsWeekly
includedObjectVersions: All
schedule:
frequency: Daily
filter:
prefix: documents/
destination:
bucket:
format: ORC
bucketArn: ${inventory.arn}
prefix: inventory

Import

Using pulumi import, import S3 bucket inventory configurations using bucket:inventory. For example:

$ pulumi import aws:s3/inventory:Inventory my-bucket-entire-bucket my-bucket:EntireBucket

Properties

Link copied to clipboard
val bucket: Output<String>

Name of the source bucket that inventory lists the objects for.

Link copied to clipboard

Contains information about where to publish the inventory results (documented below).

Link copied to clipboard
val enabled: Output<Boolean>?

Specifies whether the inventory is enabled or disabled.

Link copied to clipboard
val filter: Output<InventoryFilter>?

Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria (documented below).

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Object versions to include in the inventory list. Valid values: All, Current.

Link copied to clipboard
val name: Output<String>

Unique identifier of the inventory configuration for the bucket.

Link copied to clipboard
val optionalFields: Output<List<String>>?

List of optional fields that are included in the inventory results. Please refer to the S3 documentation for more details.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Specifies the schedule for generating inventory results (documented below).

Link copied to clipboard
val urn: Output<String>