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

Remove bucket policy statements for firehose access #8135

Merged
merged 1 commit into from
Oct 1, 2024
Merged
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
30 changes: 0 additions & 30 deletions terraform/environments/core-logging/cortex.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,8 @@ locals {
resource "random_uuid" "cortex" {}

# Because we can't use wildcards beyond "*" in a principal identifier, we use a policy condition to scope access only
# to accounts in our OU, where the role matches the name created through the modernisation-platform-terraform-aws-data-firehose module
data "aws_iam_policy_document" "logging-bucket" {
for_each = local.cortex_logging_buckets
statement {
sid = "AllowFirehosePutObject"
effect = "Allow"
principals {
type = "AWS"
identifiers = ["*"]
}
actions = [
"s3:GetObject",
"s3:PutObject",
"s3:PutObjectAcl"
]
resources = [
aws_s3_bucket.logging[each.key].arn,
"${aws_s3_bucket.logging[each.key].arn}/*"
]
condition {
test = "ForAnyValue:StringLike"
variable = "aws:PrincipalOrgPaths"
values = [
"${data.aws_organizations_organization.root_account.id}/*/${local.environment_management.modernisation_platform_organisation_unit_id}/*"
]
}
condition {
test = "ForAnyValue:StringLike"
variable = "aws:PrincipalArn"
values = ["arn:aws:iam::*:role/firehose-to-s3*"]
}
}
statement {
sid = "AWSLogDeliveryWrite"
effect = "Allow"
Expand Down