Provides a S3 bucket metrics configuration resource.
resource "aws_s3_bucket" "example" {
bucket = "example"
}
resource "aws_s3_bucket_metric" "example-entire-bucket" {
bucket = aws_s3_bucket.example.id
name = "EntireBucket"
}
resource "aws_s3_bucket" "example" {
bucket = "example"
}
resource "aws_s3_bucket_metric" "example-filtered" {
bucket = aws_s3_bucket.example.id
name = "ImportantBlueDocuments"
filter {
prefix = "documents/"
tags = {
priority = "high"
class = "blue"
}
}
}
resource "aws_s3_bucket" "example" {
bucket = "example"
}
resource "aws_s3_access_point" "example-access-point" {
bucket = aws_s3_bucket.example.id
name = "example-access-point"
}
resource "aws_s3_bucket_metric" "example-filtered" {
bucket = aws_s3_bucket.example.id
name = "ImportantBlueDocuments"
filter {
access_point = aws_s3_access_point.example-access-point.arn
tags = {
priority = "high"
class = "blue"
}
}
}
This resource supports the following arguments:
bucket
- (Required) Name of the bucket to put metric configuration.name
- (Required) Unique identifier of the metrics configuration for the bucket. Must be less than or equal to 64 characters in length.filter
- (Optional) Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).The filter
metric configuration supports the following:
access_point
- (Optional) S3 Access Point ARN for filtering (singular).prefix
- (Optional) Object prefix for filtering (singular).tags
- (Optional) Object tags for filtering (up to 10).This resource exports no additional attributes.
In Terraform v1.5.0 and later, use an import
block to import S3 bucket metric configurations using bucket:metric
. For example:
import {
to = aws_s3_bucket_metric.my-bucket-entire-bucket
id = "my-bucket:EntireBucket"
}
Using terraform import
, import S3 bucket metric configurations using bucket:metric
. For example:
% terraform import aws_s3_bucket_metric.my-bucket-entire-bucket my-bucket:EntireBucket