43 lines
772 B
Terraform
43 lines
772 B
Terraform
|
|
||
|
module "s3_bucket" {
|
||
|
source = "terraform-aws-modules/s3-bucket/aws"
|
||
|
|
||
|
bucket = "mastodon-${random_pet.name.id}"
|
||
|
# acl = "private"
|
||
|
|
||
|
versioning = {
|
||
|
enabled = false
|
||
|
}
|
||
|
|
||
|
# server_side_encryption_configuration = {
|
||
|
# rule = {
|
||
|
# apply_server_side_encryption_by_default = {
|
||
|
# sse_algorithm = "AES256"
|
||
|
# }
|
||
|
#
|
||
|
# bucket_key_enabled = true
|
||
|
# }
|
||
|
# }
|
||
|
|
||
|
}
|
||
|
|
||
|
resource "aws_iam_access_key" "s3" {
|
||
|
user = aws_iam_user.s3.name
|
||
|
}
|
||
|
|
||
|
resource "aws_iam_user" "s3" {
|
||
|
name = "mastodon-s3-${random_pet.name.id}"
|
||
|
path = "/system/"
|
||
|
}
|
||
|
|
||
|
resource "local_file" "s3_secret" {
|
||
|
filename = ".s3_secret"
|
||
|
content = "${aws_iam_access_key.s3.secret}\n"
|
||
|
}
|
||
|
|
||
|
resource "local_file" "s3_id" {
|
||
|
filename = ".s3_id"
|
||
|
content = "${aws_iam_access_key.s3.id}\n"
|
||
|
}
|
||
|
|