pulumi_wasm_providers_aws_mini::s3

Module bucket_logging_v_2

source
Expand description

Provides an S3 bucket (server access) logging resource. For more information, see Logging requests using server access logging in the AWS S3 User Guide.

Note: Amazon S3 supports server access logging, AWS CloudTrail, or a combination of both. Refer to the Logging options for Amazon S3 to decide which method meets your requirements.

This resource cannot be used with S3 directory buckets.

§Example Usage

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let example = bucket_v_2::create(
        "example",
        BucketV2Args::builder().bucket("my-tf-example-bucket").build_struct(),
    );
    let exampleBucketAclV2 = bucket_acl_v_2::create(
        "exampleBucketAclV2",
        BucketAclV2Args::builder().acl("private").bucket("${example.id}").build_struct(),
    );
    let exampleBucketLoggingV2 = bucket_logging_v_2::create(
        "exampleBucketLoggingV2",
        BucketLoggingV2Args::builder()
            .bucket("${example.id}")
            .target_bucket("${logBucket.id}")
            .target_prefix("log/")
            .build_struct(),
    );
    let logBucket = bucket_v_2::create(
        "logBucket",
        BucketV2Args::builder().bucket("my-tf-log-bucket").build_struct(),
    );
    let logBucketAcl = bucket_acl_v_2::create(
        "logBucketAcl",
        BucketAclV2Args::builder()
            .acl("log-delivery-write")
            .bucket("${logBucket.id}")
            .build_struct(),
    );
}

§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 logging 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:

$ pulumi import aws:s3/bucketLoggingV2:BucketLoggingV2 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 (,):

$ pulumi import aws:s3/bucketLoggingV2:BucketLoggingV2 example bucket-name,123456789012

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments