Skip to content
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

Scope down unnecessary permissions #49

Merged
merged 12 commits into from
Apr 19, 2024
12 changes: 8 additions & 4 deletions data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ data "aws_iam_policy_document" "mwaa" {
statement {
effect = "Allow"
actions = [
"s3:*"
"s3:GetObject*",
"s3:GetBucket*",
"s3:List*"
]
resources = [
local.source_bucket_arn,
Expand Down Expand Up @@ -84,9 +86,7 @@ data "aws_iam_policy_document" "mwaa" {
actions = [
"logs:DescribeLogGroups",
"cloudwatch:PutMetricData",
"batch:DescribeJobs",
"batch:ListJobs",
"eks:*"
"s3:GetAccountPublicAccessBlock"
]
resources = [
"*"
Expand All @@ -108,6 +108,10 @@ data "aws_iam_policy_document" "mwaa" {
]
}

# See note in https://docs.aws.amazon.com/mwaa/latest/userguide/mwaa-create-role.html
# if MWAA is using a AWS managed KMS key, we have to give permission to the key in ?? account
# We don't know what account AWS puts their key in so we use not_resources to grant access to all
# accounts except for ours
dynamic "statement" {
for_each = var.kms_key != null ? [] : [1]
content {
Expand Down