-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaws-iam-glue-setup.tf
44 lines (40 loc) · 960 Bytes
/
aws-iam-glue-setup.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
# Glue Role and Policy
resource "aws_iam_role" "glue_role" {
name = "glue_service_role"
assume_role_policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "glue.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
})
}
resource "aws_iam_policy" "glue_s3_access_policy" {
name = "GlueS3AccessPolicy"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:ListBucket"
],
"Resource": [
aws_s3_bucket.iceberg_bucket.arn,
"${aws_s3_bucket.iceberg_bucket.arn}/*"
]
}
]
})
}
resource "aws_iam_role_policy_attachment" "glue_policy_attachment" {
role = aws_iam_role.glue_role.name
policy_arn = aws_iam_policy.glue_s3_access_policy.arn
}