provider "aws" {
  region  = "ap-northeast-2"
}

resource "aws_s3_bucket" "druid-prod" {
  bucket = "druid.kr.datasaker.io"

  tags = {
    Name        = "druid.kr.datasaker.io"
  }
}

resource "aws_iam_user" "druid-s3-prod" {
  name = "druid-s3-prod"
}

resource "aws_iam_user_policy" "druid-s3-policy" {
  name  = "druid-s3-policy"
  user  = aws_iam_user.druid-s3-prod.name

  policy = <<EOF
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:*",
                "s3-object-lambda:*"
            ],
            "Resource": "*"
        }
    ]
}
EOF
}
