-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathathena.tf
44 lines (36 loc) · 1.07 KB
/
athena.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
resource "aws_s3_bucket" "athena" {
bucket = "${local.project}-athena-results"
}
resource "aws_s3_bucket_acl" "athena" {
bucket = aws_s3_bucket.athena.id
acl = "private"
}
resource "aws_s3_bucket_versioning" "athena" {
bucket = aws_s3_bucket.athena.id
versioning_configuration {
status = "Enabled"
}
}
resource "aws_s3_bucket_server_side_encryption_configuration" "athena" {
bucket = aws_s3_bucket.athena.id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
resource "aws_s3_bucket_public_access_block" "athena" {
bucket = aws_s3_bucket.athena.id
block_public_acls = true
block_public_policy = true
restrict_public_buckets = true
ignore_public_acls = true
}
resource "aws_athena_database" "main" {
name = "${local.project}_athena_db"
bucket = aws_s3_bucket.athena.bucket
encryption_configuration {
encryption_option = "SSE_KMS"
kms_key = "arn:aws:kms:${var.aws_region}:${data.aws_caller_identity.current.account_id}:key/${module.athena_kms.key_id}"
}
}