@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
193 lines (192 loc) • 8.33 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Provides a resource for controlling versioning on an S3 bucket.
* Deleting this resource will either suspend versioning on the associated S3 bucket or
* simply remove the resource from state if the associated S3 bucket is unversioned.
*
* For more information, see [How S3 versioning works](https://docs.aws.amazon.com/AmazonS3/latest/userguide/manage-versioning-examples.html).
*
* > **NOTE:** If you are enabling versioning on the bucket for the first time, AWS recommends that you wait for 15 minutes after enabling versioning before issuing write operations (PUT or DELETE) on objects in the bucket.
*
* > This resource cannot be used with S3 directory buckets.
*
* ## Example Usage
*
* ### With Versioning Enabled
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.s3.Bucket("example", {bucket: "example-bucket"});
* const exampleBucketAcl = new aws.s3.BucketAcl("example", {
* bucket: example.id,
* acl: "private",
* });
* const versioningExample = new aws.s3.BucketVersioning("versioning_example", {
* bucket: example.id,
* versioningConfiguration: {
* status: "Enabled",
* },
* });
* ```
*
* ### With Versioning Disabled
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.s3.Bucket("example", {bucket: "example-bucket"});
* const exampleBucketAcl = new aws.s3.BucketAcl("example", {
* bucket: example.id,
* acl: "private",
* });
* const versioningExample = new aws.s3.BucketVersioning("versioning_example", {
* bucket: example.id,
* versioningConfiguration: {
* status: "Disabled",
* },
* });
* ```
*
* ### Object Dependency On Versioning
*
* When you create an object whose `versionId` you need and an `aws.s3.BucketVersioning` resource in the same configuration, you are more likely to have success by ensuring the `s3Object` depends either implicitly (see below) or explicitly (i.e., using `dependsOn = [aws_s3_bucket_versioning.example]`) on the `aws.s3.BucketVersioning` resource.
*
* > **NOTE:** For critical and/or production S3 objects, do not create a bucket, enable versioning, and create an object in the bucket within the same configuration. Doing so will not allow the AWS-recommended 15 minutes between enabling versioning and writing to the bucket.
*
* This example shows the `aws_s3_object.example` depending implicitly on the versioning resource through the reference to `aws_s3_bucket_versioning.example.bucket` to define `bucket`:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.s3.Bucket("example", {bucket: "yotto"});
* const exampleBucketVersioning = new aws.s3.BucketVersioning("example", {
* bucket: example.id,
* versioningConfiguration: {
* status: "Enabled",
* },
* });
* const exampleBucketObjectv2 = new aws.s3.BucketObjectv2("example", {
* bucket: exampleBucketVersioning.id,
* key: "droeloe",
* source: new pulumi.asset.FileAsset("example.txt"),
* });
* ```
*
* ## Import
*
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
*
* __Using `pulumi import` to import__ S3 bucket versioning using the `bucket` or using the `bucket` and `expected_bucket_owner` separated by a comma (`,`). For example:
*
* If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, import using the `bucket`:
*
* ```sh
* $ pulumi import aws:s3/bucketVersioning:BucketVersioning example bucket-name
* ```
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
*
* ```sh
* $ pulumi import aws:s3/bucketVersioning:BucketVersioning example bucket-name,123456789012
* ```
*/
export declare class BucketVersioning extends pulumi.CustomResource {
/**
* Get an existing BucketVersioning resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: BucketVersioningState, opts?: pulumi.CustomResourceOptions): BucketVersioning;
/**
* Returns true if the given object is an instance of BucketVersioning. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is BucketVersioning;
/**
* Name of the S3 bucket.
*/
readonly bucket: pulumi.Output<string>;
/**
* Account ID of the expected bucket owner.
*/
readonly expectedBucketOwner: pulumi.Output<string | undefined>;
/**
* Concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.
*/
readonly mfa: pulumi.Output<string | undefined>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
readonly region: pulumi.Output<string>;
/**
* Configuration block for the versioning parameters. See below.
*/
readonly versioningConfiguration: pulumi.Output<outputs.s3.BucketVersioningVersioningConfiguration>;
/**
* Create a BucketVersioning resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: BucketVersioningArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering BucketVersioning resources.
*/
export interface BucketVersioningState {
/**
* Name of the S3 bucket.
*/
bucket?: pulumi.Input<string>;
/**
* Account ID of the expected bucket owner.
*/
expectedBucketOwner?: pulumi.Input<string>;
/**
* Concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.
*/
mfa?: pulumi.Input<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* Configuration block for the versioning parameters. See below.
*/
versioningConfiguration?: pulumi.Input<inputs.s3.BucketVersioningVersioningConfiguration>;
}
/**
* The set of arguments for constructing a BucketVersioning resource.
*/
export interface BucketVersioningArgs {
/**
* Name of the S3 bucket.
*/
bucket: pulumi.Input<string>;
/**
* Account ID of the expected bucket owner.
*/
expectedBucketOwner?: pulumi.Input<string>;
/**
* Concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.
*/
mfa?: pulumi.Input<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* Configuration block for the versioning parameters. See below.
*/
versioningConfiguration: pulumi.Input<inputs.s3.BucketVersioningVersioningConfiguration>;
}