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

IA-3420: Updated ECS task policy to include permissions to write logs… #184

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions terraform/fargate.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module "api" {

## If the ecs task needs to access AWS API for any reason, grant
## it permissions with this parameter and the policy resource below
#task_policy_json = data.aws_iam_policy_document.fargate.json
task_policy_json = data.aws_iam_policy_document.fargate.json

# Deployment
enable_deployment_rollbacks = true
Expand Down Expand Up @@ -82,14 +82,19 @@ module "api" {
}

## If the ecs task needs to access AWS API for any reason, grant it permissions with this
#
#data "aws_iam_policy_document" "fargate" {
# statement {
# sid = "AllResources"
# actions = [
# "s3:ListAllMyBuckets",
# "s3:GetBucketLocation",
# ]
# resources = ["*"]
# }
#}

data "aws_iam_policy_document" "fargate" {
statement {
sid = "AllResources"
actions = [
"s3:GetObject",
"s3:PutObject",
"s3:List*",
"s3:GetBucketLocation",
]
resources = [
"${data.aws_s3_bucket.logs.arn}",
"${data.aws_s3_bucket.logs.arn}/*"
]
}
}
4 changes: 4 additions & 0 deletions terraform/infrastructure-resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ data "aws_sns_topic" "alerts" {
for_each = toset(["green", "yellow", "red", "security"])
name = "${local.account_name}-teams-${each.value}-notifications"
}

data "aws_s3_bucket" "logs" {
bucket = "${local.account_ids[terraform.workspace]}-${local.region}-logs"
}
Loading