-
Notifications
You must be signed in to change notification settings - Fork 0
/
glue_raw.tf
91 lines (69 loc) · 2.04 KB
/
glue_raw.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# resource "aws_glue_catalog_table" "citydata" {
# name = "mycitydata"
# database_name = "sampledb"
# storage_descriptor {
# location = format("s3://%s/", aws_s3_bucket.data_glue.id)
# input_format = "org.apache.hadoop.mapred.TextInputFormat"
# output_format = "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"
# ser_de_info {
# serialization_library = "org.apache.hadoop.hive.serde2.OpenCSVSerde"
# parameters = {
# "separatorChar" = ","
# }
# }
# columns {
# name = "id"
# type = "INT"
# }
# columns {
# name = "country"
# type = "STRING"
# }
# columns {
# name = "state"
# type = "STRING"
# }
# columns {
# name = "city"
# type = "STRING"
# }
# columns {
# name = "amount"
# type = "DECIMAL"
# }
# }
# // Table Parameters
# parameters = {
# "classification" = "csv"
# }
# }
resource "aws_glue_catalog_database" "raw" {
name = "raw-database"
description = "Glue ETL for Raw Files"
location_uri = "/raw/database/"
}
resource "aws_glue_security_configuration" "raw_bucket" {
name = format("%s-raw-data", var.project_name)
encryption_configuration {
cloudwatch_encryption {
cloudwatch_encryption_mode = "DISABLED"
}
job_bookmarks_encryption {
job_bookmarks_encryption_mode = "DISABLED"
}
s3_encryption {
kms_key_arn = aws_kms_key.main.arn
s3_encryption_mode = "SSE-KMS"
}
}
}
resource "aws_glue_crawler" "raw_bucket" {
database_name = aws_glue_catalog_database.raw.name
name = format("%s-raw-data", var.project_name)
role = aws_iam_role.glue.arn
schedule = var.glue_raw_data_crawler_schedule
s3_target {
path = "s3://${aws_s3_bucket.raw_bucket.bucket}/"
}
security_configuration = aws_glue_security_configuration.raw_bucket.id
}