-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Satellite region]: add IAM permissions for supporting feature service running in satellite region #56
base: master
Are you sure you want to change the base?
[Satellite region]: add IAM permissions for supporting feature service running in satellite region #56
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,25 @@ resource "aws_iam_role_policy_attachment" "emr_cross_account_policy_attachment" | |
role = aws_iam_role.cross_account_role.name | ||
} | ||
|
||
# CROSS ACCOUNT SATELLITE SERVING | ||
resource "aws_iam_policy" "emr_cross_account_satellite_region_policy" { | ||
count = var.create_emr_roles && var.satellite_region != null ? 1 : 0 | ||
name = "tecton-${var.deployment_name}-cross-account-satellite-region-policy-emr" | ||
policy = templatefile("${path.module}/../templates/satellite_serving_dynamodb_policy.json", { | ||
ACCOUNT_ID = var.account_id | ||
DEPLOYMENT_NAME = var.deployment_name | ||
REGION = var.region | ||
EMR_MANAGER_ROLE = aws_iam_role.emr_master_role[0].name | ||
SPARK_ROLE = aws_iam_role.emr_spark_role[0].name | ||
}) | ||
tags = local.tags | ||
} | ||
resource "aws_iam_role_policy_attachment" "emr_cross_account_satellite_region_policy_attachment" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here rename to emr_cross_account_satellite_region since it's already policy_attachment by resource |
||
count = var.create_emr_roles && var.satellite_region != null ? 1 : 0 | ||
policy_arn = aws_iam_policy.emr_cross_account_satellite_region_policy[0].arn | ||
role = aws_iam_role.cross_account_role.name | ||
} | ||
|
||
# SPARK ROLE | ||
resource "aws_iam_role" "emr_spark_role" { | ||
count = var.create_emr_roles ? 1 : 0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,3 +63,20 @@ resource "aws_iam_role_policy_attachment" "common_spark_policy_attachment" { | |
policy_arn = aws_iam_policy.common_spark_policy.arn | ||
role = local.spark_role_name | ||
} | ||
|
||
resource "aws_iam_policy" "satellite_region_policy" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
count = var.satellite_region == null ? 0 : 1 | ||
name = "tecton-satellite-region-policy" | ||
policy = templatefile("${path.module}/../templates/satellite_ca_policy.json", { | ||
ACCOUNT_ID = var.account_id | ||
DEPLOYMENT_NAME = var.deployment_name | ||
REGION = var.region | ||
SATELLITE_REGION = var.satellite_region | ||
}) | ||
tags = local.tags | ||
} | ||
resource "aws_iam_role_policy_attachment" "satellite_region_policy_attachment" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here |
||
count = var.satellite_region == null ? 0 : 1 | ||
policy_arn = aws_iam_policy.satellite_region_policy[0].arn | ||
role = local.spark_role_name | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Sid": "DynamoDB", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"dynamodb:BatchGetItem", | ||
"dynamodb:BatchWriteItem", | ||
"dynamodb:ConditionCheckItem", | ||
"dynamodb:CreateTable", | ||
"dynamodb:DeleteItem", | ||
"dynamodb:DeleteTable", | ||
"dynamodb:DescribeTable", | ||
"dynamodb:GetItem", | ||
"dynamodb:PutItem", | ||
"dynamodb:Query", | ||
"dynamodb:TagResource", | ||
"dynamodb:UpdateTable" | ||
], | ||
"Resource": [ | ||
"arn:aws:dynamodb:${REGION}:${ACCOUNT_ID}:table/tecton-${DEPLOYMENT_NAME}*", | ||
"arn:aws:dynamodb:${SATELLITE_REGION}:${ACCOUNT_ID}:table/tecton-${DEPLOYMENT_NAME}*" | ||
] | ||
}, | ||
{ | ||
"Sid": "DynamoDBCrossRegion", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"dynamodb:CreateTableReplica", | ||
"dynamodb:Scan", | ||
"dynamodb:UpdateItem", | ||
"dynamodb:DeleteTableReplica" | ||
], | ||
"Resource": [ | ||
"arn:aws:dynamodb:${SATELLITE_REGION}:${ACCOUNT_ID}:table/tecton-${DEPLOYMENT_NAME}*" | ||
] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Sid": "CreateSatelliteServingDynamoDBServiceLinkedRole", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"iam:CreateServiceLinkedRole" | ||
], | ||
"Resource": [ | ||
"arn:aws:iam::*:role/aws-service-role/replication.dynamodb.amazonaws.com/AWSServiceRoleForDynamoDBReplication*" | ||
], | ||
"Condition": { | ||
"StringLike": { | ||
"iam:AWSServiceName": [ | ||
"replication.dynamodb.amazonaws.com" | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename this to emr_cross_account_satellite_region since this is aws_iam_policy already