Resource: aws_s3control_storage_lens_configuration

Provides a resource to manage an S3 Storage Lens configuration.

Example Usage

data "aws_caller_identity" "current" {}

resource "aws_s3control_storage_lens_configuration" "example" {
  config_id = "example-1"

  storage_lens_configuration {
    enabled = true

    account_level {
      activity_metrics {
        enabled = true
      }

      bucket_level {
        activity_metrics {
          enabled = true
        }
      }
    }

    data_export {
      cloud_watch_metrics {
        enabled = true
      }

      s3_bucket_destination {
        account_id            = data.aws_caller_identity.current.account_id
        arn                   = aws_s3_bucket.target.arn
        format                = "CSV"
        output_schema_version = "V_1"

        encryption {
          sse_s3 {}
        }
      }
    }

    exclude {
      buckets = [aws_s3_bucket.b1.arn, aws_s3_bucket.b2.arn]
      regions = ["us-east-2"]
    }
  }
}

Argument Reference

This resource supports the following arguments:

Storage Lens Configuration

The storage_lens_configuration block supports the following:

Account Level

The account_level block supports the following:

Activity Metrics

The activity_metrics block supports the following:

Advanced Cost-Optimization Metrics

The advanced_cost_optimization_metrics block supports the following:

Advanced Data-Protection Metrics

The advanced_data_protection_metrics block supports the following:

Detailed Status Code Metrics

The detailed_status_code_metrics block supports the following:

Bucket Level

The bucket_level block supports the following:

Prefix Level

The prefix_level block supports the following:

Prefix Level Storage Metrics

The storage_metrics block supports the following:

Selection Criteria

The selection_criteria block supports the following:

AWS Org

The aws_org block supports the following:

Data Export

The data_export block supports the following:

Cloud Watch Metrics

The cloud_watch_metrics block supports the following:

S3 Bucket Destination

The s3_bucket_destination block supports the following:

Encryption

The encryption block supports the following:

SSE KMS

The sse_kms block supports the following:

Exclude

The exclude block supports the following:

Include

The include block supports the following:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import S3 Storage Lens configurations using the account_id and config_id, separated by a colon (:). For example:

import {
  to = aws_s3control_storage_lens_configuration.example
  id = "123456789012:example-1"
}

Using terraform import, import S3 Storage Lens configurations using the account_id and config_id, separated by a colon (:). For example:

% terraform import aws_s3control_storage_lens_configuration.example 123456789012:example-1