|
@@ -4,7 +4,7 @@
|
|
|
|
|
|
# IAM role for EMR Service
|
|
|
resource "aws_iam_role" "iam_emr_service_role" {
|
|
|
- name_prefix = local.unique_id
|
|
|
+ name_prefix = substr("svc-role-${local.unique_id}-", 0, 38)
|
|
|
|
|
|
assume_role_policy = <<EOF
|
|
|
{
|
|
@@ -86,15 +86,20 @@ data "aws_iam_policy_document" "iam_emr_service_policy" {
|
|
|
}
|
|
|
|
|
|
resource "aws_iam_role_policy" "iam_emr_service_policy" {
|
|
|
- name_prefix = local.unique_id
|
|
|
+ name_prefix = substr("svc-pol-${local.unique_id}-", 0, 38)
|
|
|
role = aws_iam_role.iam_emr_service_role.id
|
|
|
|
|
|
policy = data.aws_iam_policy_document.iam_emr_service_policy.json
|
|
|
}
|
|
|
|
|
|
+resource "aws_iam_role_policy_attachment" "iam_emr_service_policy" {
|
|
|
+ role = aws_iam_role.iam_emr_service_role.name
|
|
|
+ policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEMRServicePolicy_v2"
|
|
|
+}
|
|
|
+
|
|
|
# IAM Role for EC2 Instance Profile
|
|
|
resource "aws_iam_role" "iam_emr_profile_role" {
|
|
|
- name_prefix = local.unique_id
|
|
|
+ name_prefix = substr("emr-prof-${local.unique_id}-", 0, 38)
|
|
|
|
|
|
assume_role_policy = <<EOF
|
|
|
{
|
|
@@ -114,7 +119,7 @@ EOF
|
|
|
}
|
|
|
|
|
|
resource "aws_iam_instance_profile" "emr_profile" {
|
|
|
- name_prefix = local.unique_id
|
|
|
+ name_prefix = substr("emr-prof-${local.unique_id}-", 0, 38)
|
|
|
role = aws_iam_role.iam_emr_profile_role.name
|
|
|
}
|
|
|
|
|
@@ -147,12 +152,36 @@ data "aws_iam_policy_document" "iam_emr_profile_policy" {
|
|
|
"sdb:*",
|
|
|
"sns:*",
|
|
|
"sqs:*",
|
|
|
+ "glue:CreateDatabase",
|
|
|
+ "glue:UpdateDatabase",
|
|
|
+ "glue:DeleteDatabase",
|
|
|
+ "glue:GetDatabase",
|
|
|
+ "glue:GetDatabases",
|
|
|
+ "glue:CreateTable",
|
|
|
+ "glue:UpdateTable",
|
|
|
+ "glue:DeleteTable",
|
|
|
+ "glue:GetTable",
|
|
|
+ "glue:GetTables",
|
|
|
+ "glue:GetTableVersions",
|
|
|
+ "glue:CreatePartition",
|
|
|
+ "glue:BatchCreatePartition",
|
|
|
+ "glue:UpdatePartition",
|
|
|
+ "glue:DeletePartition",
|
|
|
+ "glue:BatchDeletePartition",
|
|
|
+ "glue:GetPartition",
|
|
|
+ "glue:GetPartitions",
|
|
|
+ "glue:BatchGetPartition",
|
|
|
+ "glue:CreateUserDefinedFunction",
|
|
|
+ "glue:UpdateUserDefinedFunction",
|
|
|
+ "glue:DeleteUserDefinedFunction",
|
|
|
+ "glue:GetUserDefinedFunction",
|
|
|
+ "glue:GetUserDefinedFunctions"
|
|
|
]
|
|
|
}
|
|
|
}
|
|
|
|
|
|
resource "aws_iam_role_policy" "iam_emr_profile_policy" {
|
|
|
- name_prefix = local.unique_id
|
|
|
+ name_prefix = substr("emr-prof-${local.unique_id}-", 0, 38)
|
|
|
role = aws_iam_role.iam_emr_profile_role.id
|
|
|
|
|
|
policy = data.aws_iam_policy_document.iam_emr_profile_policy.json
|