diff --git a/modules/aws-s3-bucket/main.tf b/modules/aws-s3-bucket/main.tf index b8ae811..36b82b7 100644 --- a/modules/aws-s3-bucket/main.tf +++ b/modules/aws-s3-bucket/main.tf @@ -1,28 +1,23 @@ -/* S3 BACKUPS BUCKET ----------------------------*/ - -resource "aws_iam_user" "mongodb_backup" { - name = "mongodb-backups" +resource "aws_iam_user" "main" { + name = var.bucket_name tags = { - Description = "User for S3 MongoDB backups" + Description = "User for ${var.bucket_name} S3 bucket" } } -resource "aws_iam_access_key" "mongodb_backup" { - user = aws_iam_user.mongodb_backup.name +resource "aws_iam_access_key" "main" { + user = aws_iam_user.main.name pgp_key = file("files/support@dap.ps.gpg") } -resource "aws_s3_bucket" "mongodb_backup" { - bucket = "dev-dap-ps-mongodb-backups" +resource "aws_s3_bucket" "main" { + bucket = var.bucket_name acl = "private" tags = { - Name = "Bucket for MongoDB backups" - } - - lifecycle { - prevent_destroy = true + Name = var.bucket_name + Desc = var.description } policy = <