bucket_arn
ARN of the S3 bucket. Use this for IAM policies, resource references, and cross-service integrations.
The Amazon Resource Name (ARN) of the S3 bucket. Use this for IAM policies, resource references, and cross-service integrations.
Example Value
arn:aws:s3:::my-app-data
Common Use Cases
IAM Policy Resource
resource "aws_iam_policy" "bucket_access" {
name = "bucket-access"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = [
"s3:GetObject",
"s3:PutObject"
]
Resource = "${module.data_bucket.bucket_arn}/*"
},
{
Effect = "Allow"
Action = "s3:ListBucket"
Resource = module.data_bucket.bucket_arn
}
]
})
}
Lambda Function Environment
module "processor" {
source = "registry.patterneddesigns.ca/patterneddesigns/lambda-function/aws"
environment_variables = {
BUCKET_ARN = module.data_bucket.bucket_arn
}
}
CloudWatch Alarm
resource "aws_cloudwatch_metric_alarm" "bucket_size" {
dimensions = {
BucketName = split(":", module.data_bucket.bucket_arn)[5]
}
}
Usage
module "s3_bucket" {
source = "registry.patterneddesigns.ca/essentials/s3-bucket/aws"
version = "0.1.0"
# ... inputs
}
# Access this output
output "bucket_arn" {
value = module.s3_bucket.bucket_arn
}