Skip to content

Commit

Permalink
Fix for issue #4 (#5)
Browse files Browse the repository at this point in the history
* Fix for issue #4
#4

* Fix formatting

Co-authored-by: Julian Nonino <[email protected]>
  • Loading branch information
ptwohig and jnonino authored Jul 30, 2022
1 parent 561944a commit e1f2cb6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,22 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "logs" {
#------------------------------------------------------------------------------
# IAM POLICY DOCUMENT - For access logs to the S3 bucket
#------------------------------------------------------------------------------
data "aws_caller_identity" "current" {}

locals {
aws_principals_identifiers = (
length(var.aws_principals_identifiers) == 0
? [data.aws_caller_identity.current.account_id]
: var.aws_principals_identifiers
)
}

data "aws_iam_policy_document" "logs_access_policy_document" {
statement {
effect = "Allow"
principals {
type = "AWS"
identifiers = var.aws_principals_identifiers
identifiers = local.aws_principals_identifiers
}
actions = ["s3:PutObject"]
resources = ["${aws_s3_bucket.logs.arn}/*", ]
Expand Down

0 comments on commit e1f2cb6

Please sign in to comment.