Provides a resource to manage an S3 Storage Lens configuration.
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"]
}
}
}
This resource supports the following arguments:
account_id
- (Optional) The AWS account ID for the S3 Storage Lens configuration. Defaults to automatically determined account ID of the Terraform AWS provider.config_id
- (Required) The ID of the S3 Storage Lens configuration.storage_lens_configuration
- (Required) The S3 Storage Lens configuration. See Storage Lens Configuration below for more details.tags
- (Optional) Key-value map of resource tags. If configured with a provider default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.The storage_lens_configuration
block supports the following:
account_level
(Required) The account-level configurations of the S3 Storage Lens configuration. See Account Level below for more details.aws_org
(Optional) The Amazon Web Services organization for the S3 Storage Lens configuration. See AWS Org below for more details.data_export
(Optional) Properties of S3 Storage Lens metrics export including the destination, schema and format. See Data Export below for more details.enabled
(Required) Whether the S3 Storage Lens configuration is enabled.exclude
(Optional) What is excluded in this configuration. Conflicts with include
. See Exclude below for more details.include
(Optional) What is included in this configuration. Conflicts with exclude
. See Include below for more details.The account_level
block supports the following:
activity_metrics
(Optional) S3 Storage Lens activity metrics. See Activity Metrics below for more details.advanced_cost_optimization_metrics
(Optional) Advanced cost-optimization metrics for S3 Storage Lens. See Advanced Cost-Optimization Metrics below for more details.advanced_data_protection_metrics
(Optional) Advanced data-protection metrics for S3 Storage Lens. See Advanced Data-Protection Metrics below for more details.bucket_level
(Required) S3 Storage Lens bucket-level configuration. See Bucket Level below for more details.detailed_status_code_metrics
(Optional) Detailed status code metrics for S3 Storage Lens. See Detailed Status Code Metrics below for more details.The activity_metrics
block supports the following:
enabled
(Optional) Whether the activity metrics are enabled.The advanced_cost_optimization_metrics
block supports the following:
enabled
(Optional) Whether advanced cost-optimization metrics are enabled.The advanced_data_protection_metrics
block supports the following:
enabled
(Optional) Whether advanced data-protection metrics are enabled.The detailed_status_code_metrics
block supports the following:
enabled
(Optional) Whether detailed status code metrics are enabled.The bucket_level
block supports the following:
activity_metrics
(Optional) S3 Storage Lens activity metrics. See Activity Metrics above for more details.advanced_cost_optimization_metrics
(Optional) Advanced cost-optimization metrics for S3 Storage Lens. See Advanced Cost-Optimization Metrics above for more details.advanced_data_protection_metrics
(Optional) Advanced data-protection metrics for S3 Storage Lens. See Advanced Data-Protection Metrics above for more details.detailed_status_code_metrics
(Optional) Detailed status code metrics for S3 Storage Lens. See Detailed Status Code Metrics above for more details.prefix_level
(Optional) Prefix-level metrics for S3 Storage Lens. See Prefix Level below for more details.The prefix_level
block supports the following:
storage_metrics
(Required) Prefix-level storage metrics for S3 Storage Lens. See Prefix Level Storage Metrics below for more details.The storage_metrics
block supports the following:
enabled
(Optional) Whether prefix-level storage metrics are enabled.selection_criteria
(Optional) Selection criteria. See Selection Criteria below for more details.The selection_criteria
block supports the following:
delimiter
(Optional) The delimiter of the selection criteria being used.max_depth
(Optional) The max depth of the selection criteria.min_storage_bytes_percentage
(Optional) The minimum number of storage bytes percentage whose metrics will be selected.The aws_org
block supports the following:
arn
(Required) The Amazon Resource Name (ARN) of the Amazon Web Services organization.The data_export
block supports the following:
cloud_watch_metrics
(Optional) Amazon CloudWatch publishing for S3 Storage Lens metrics. See Cloud Watch Metrics below for more details.s3_bucket_destination
(Optional) The bucket where the S3 Storage Lens metrics export will be located. See S3 Bucket Destination below for more details.The cloud_watch_metrics
block supports the following:
enabled
(Required) Whether CloudWatch publishing for S3 Storage Lens metrics is enabled.The s3_bucket_destination
block supports the following:
account_id
(Required) The account ID of the owner of the S3 Storage Lens metrics export bucket.arn
(Required) The Amazon Resource Name (ARN) of the bucket.encryption
(Optional) Encryption of the metrics exports in this bucket. See Encryption below for more details.format
(Required) The export format. Valid values: CSV
, Parquet
.output_schema_version
(Required) The schema version of the export file. Valid values: V_1
.prefix
(Optional) The prefix of the destination bucket where the metrics export will be delivered.The encryption
block supports the following:
sse_kms
(Optional) SSE-KMS encryption. See SSE KMS below for more details.sse_s3
(Optional) SSE-S3 encryption. An empty configuration block {}
should be used.The sse_kms
block supports the following:
key_id
(Required) KMS key ARN.The exclude
block supports the following:
buckets
(Optional) List of S3 bucket ARNs.regions
(Optional) List of AWS Regions.The include
block supports the following:
buckets
(Optional) List of S3 bucket ARNs.regions
(Optional) List of AWS Regions.This resource exports the following attributes in addition to the arguments above:
arn
- Amazon Resource Name (ARN) of the S3 Storage Lens configuration.tags_all
- A map of tags assigned to the resource, including those inherited from the provider default_tags
configuration block.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