Resource: awsS3BucketInventory
Provides a S3 bucket inventory configuration resource.
Example Usage
Add inventory configuration
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsS3BucketInventory = new aws.s3Bucket.S3Bucket(this, "inventory", {
bucket: "my-tf-inventory-bucket",
});
const awsS3BucketTest = new aws.s3Bucket.S3Bucket(this, "test", {
bucket: "my-tf-test-bucket",
});
const awsS3BucketInventoryTest = new aws.s3BucketInventory.S3BucketInventory(
this,
"test_2",
{
bucket: awsS3BucketTest.id,
destination: {
bucket: {
bucketArn: awsS3BucketInventory.arn,
format: "ORC",
},
},
includedObjectVersions: "All",
name: "EntireBucketDaily",
schedule: {
frequency: "Daily",
},
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsS3BucketInventoryTest.overrideLogicalId("test");
Add inventory configuration with S3 object prefix
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsS3BucketInventory = new aws.s3Bucket.S3Bucket(this, "inventory", {
bucket: "my-tf-inventory-bucket",
});
const awsS3BucketTest = new aws.s3Bucket.S3Bucket(this, "test", {
bucket: "my-tf-test-bucket",
});
new aws.s3BucketInventory.S3BucketInventory(this, "test-prefix", {
bucket: awsS3BucketTest.id,
destination: {
bucket: {
bucketArn: awsS3BucketInventory.arn,
format: "ORC",
prefix: "inventory",
},
},
filter: {
prefix: "documents/",
},
includedObjectVersions: "All",
name: "DocumentsWeekly",
schedule: {
frequency: "Daily",
},
});
Argument Reference
The following arguments are supported:
bucket
- (Required) Name of the source bucket that inventory lists the objects for.name
- (Required) Unique identifier of the inventory configuration for the bucket.includedObjectVersions
- (Required) Object versions to include in the inventory list. Valid values:all
,current
.schedule
- (Required) Specifies the schedule for generating inventory results (documented below).destination
- (Required) Contains information about where to publish the inventory results (documented below).enabled
- (Optional, Default:true
) Specifies whether the inventory is enabled or disabled.filter
- (Optional) Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria (documented below).optionalFields
- (Optional) List of optional fields that are included in the inventory results. Please refer to the S3 documentation for more details.
The filter
configuration supports the following:
prefix
- (Optional) Prefix that an object must have to be included in the inventory results.
The schedule
configuration supports the following:
frequency
- (Required) Specifies how frequently inventory results are produced. Valid values:daily
,weekly
.
The destination
configuration supports the following:
bucket
- (Required) S3 bucket configuration where inventory results are published (documented below).
The bucket
configuration supports the following:
bucketArn
- (Required) Amazon S3 bucket ARN of the destination.format
- (Required) Specifies the output format of the inventory results. Can becsv
,orc
orparquet
.accountId
- (Optional) ID of the account that owns the destination bucket. Recommended to be set to prevent problems if the destination bucket ownership changes.prefix
- (Optional) Prefix that is prepended to all inventory results.encryption
- (Optional) Contains the type of server-side encryption to use to encrypt the inventory (documented below).
The encryption
configuration supports the following:
sseKms
- (Optional) Specifies to use server-side encryption with AWS KMS-managed keys to encrypt the inventory file (documented below).sseS3
- (Optional) Specifies to use server-side encryption with Amazon S3-managed keys (SSE-S3) to encrypt the inventory file.
The sseKms
configuration supports the following:
keyId
- (Required) ARN of the KMS customer master key (CMK) used to encrypt the inventory file.
Attributes Reference
No additional attributes are exported.
Import
S3 bucket inventory configurations can be imported using bucket:inventory
, e.g.,