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

EPSA-2906 terraform changes for cloud front invalidation privilege en es #1199

Open
wants to merge 1 commit into
base: live
Choose a base branch
from
Open
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
28 changes: 28 additions & 0 deletions terraform/infrastructure/drupal_iam_task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,34 @@ resource "aws_iam_role_policy_attachment" "drupal_publish_metrics" {
policy_arn = aws_iam_policy.drupal_publish_metrics.arn
}

# EPA-2906_Terraform-changes-for-CloudFront-Invalidation-privilege-en-es
data "aws_iam_policy_document" "cloudfront_permissions" {
version = "2012-10-17"

statement {
sid = "cloudfrontPermissions"
effect = "Allow"
actions = ["cloudfront:CreateInvalidation"]
resources = ["arn:aws:cloudfront::687001500421:distribution/*"]
}
}

resource "aws_iam_policy" "cloudfront_permissions" {
name = "${var.iam_prefix}-${var.aws_region}-${var.environment}-cloudfrontPermissions"
description = "Contains Cloudfront permissions"

policy = data.aws_iam_policy_document.cloudfront_permissions.json
}

resource "aws_iam_role_policy_attachment" "cloudfront_permissions" {
for_each = local.sites

role = aws_iam_role.drupal_task[each.key].name
policy_arn = aws_iam_policy.cloudfront_permissions.arn
}
# end EPA-2906_Terraform-changes-for-CloudFront-Invalidation-privilege-en-esw


# Grant the Drupal container permissions to Cloudwatch to create a log stream
# and publish log events.
data "aws_iam_policy_document" "drupal_put_logs" {
Expand Down