Using Terraform, I am declaring an s3 bucket and associated policy document, along with an iam_role and iam_role_policy.
The s3 bucket is creating fine in AWS however the bucket is listed as "Access: Objects can be public", and want the objects to be private. How can I explicitly make the objects private?
resource "aws_s3_bucket" "app" {
bucket = "${data.aws_caller_identity.current.account_id}-app"
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
}
data "aws_iam_policy_document" "app_s3_policy" {
statement {
effect = "Allow"
actions = [
"s3:PutObject"
]
resources = [
aws_s3_bucket.app.arn,
"${aws_s3_bucket.app.arn}/*"
]
}
}