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

Enable public read access to the release logs #440

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions terraform/releases/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions terraform/releases/impl/promote-release.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ resource "aws_codebuild_project" "promote_release" {
build_timeout = 120
service_role = aws_iam_role.promote_release.arn

// This CodeBuild project is marked as public to allow release team members
// without AWS access (and interested members of the community) to follow the
// release as it progresses. Doing so in CodeBuild requires defining a role
// with permission to access the logs.
project_visibility = "PUBLIC_READ"
resource_access_role = aws_iam_role.promote_release_public_access.arn

source {
type = "NO_SOURCE"
buildspec = <<-EOF
Expand Down Expand Up @@ -267,6 +274,38 @@ resource "aws_iam_role_policy" "promote_release" {
})
}

resource "aws_iam_role" "promote_release_public_access" {
name = "codebuild--promote-release--${var.name}--public-access"

assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = "sts:AssumeRole"
Principal = {
Service = "codebuild.amazonaws.com"
}
}
]
})
}

resource "aws_iam_role_policy" "promote_release_public_access" {
role = aws_iam_role.promote_release_public_access.name
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Sid = "AllowLogs"
Effect = "Allow"
Action = "logs:GetLogEvents"
Resource = "${aws_cloudwatch_log_group.promote_release.arn}:*"
}
]
})
}

data "aws_ssm_parameter" "fastly_api_token" {
name = "/${var.name}/promote-release/fastly-api-token"
with_decryption = false
Expand Down
Loading