# --------------------------------------------------------------------
# Amazon S3 output
# --------------------------------------------------------------------

output "id" {
  description = "The bucket domain name. Will be of format bucketname.s3.amazonaws.com."
  value       = aws_s3_bucket.this.id
}

output "arn" {
  description = "The ARN of the bucket. Will be of format arn:aws:s3:::bucketname."
  value       = aws_s3_bucket.this.arn
}

output "website_endpoint" {
  description = "The website endpoint, if the bucket is configured with a website. If not, this will be an empty string."
  value       = var.type == 1 ? aws_s3_bucket_website_configuration.this[0].website_endpoint : ""
}

output "domain_name" {
  description = "The bucket region-specific domain name."
  value       = aws_s3_bucket.this.bucket_regional_domain_name
}

output "cloudfront_access_identity" {
  description = "The cloudfront OAI access identity path."
  value       = aws_cloudfront_origin_access_identity.this.cloudfront_access_identity_path
}
