CodeBuild project S3 logs should be encrypted¶
This control checks if S3 logs for a CodeBuild project are encrypted. The control fails if encryption is deactivated for S3 logs for a CodeBuild project.
How to fix¶
Attribute logs_config[0].s3_logs[0].encryption_disabled of aws_codebuild_project must be false.
Implementation options¶
Choose the option that matches how you manage Terraform. All options satisfy this control.
Option 1: Terraform AWS provider resources¶
If you manage resources directly, configure the relevant Terraform AWS provider resources to meet this control. See docs for the resources involved: aws_codebuild_project.
resource "aws_codebuild_project" "this" {
artifacts {
type = "NO_ARTIFACTS"
}
environment {
compute_type = "BUILD_GENERAL1_SMALL"
image = "aws/codebuild/amazonlinux2-x86_64-standard:5.0"
type = "LINUX_CONTAINER"
}
name = "pofix-example-build"
service_role = "arn:aws:iam::123456789012:role/example-role"
source {
buildspec = "version: 0.2\nphases:\n build:\n commands:\n - echo hello"
type = "NO_SOURCE"
}
logs_config {
cloudwatch_logs {
status = "ENABLED"
}
s3_logs {
encryption_disabled = false
}
}
}
Which option should I choose?
- Compliance.tf module (recommended): controls enforced by default and mapped to frameworks.
- Open source module (
terraform-aws-modules): compatible by design with compliance.tf. Same variable names for an easy, low-change migration path when you are ready. - Terraform AWS provider resources: manage Terraform resources directly.
Tool mappings¶
Use these identifiers to cross-reference this control across tools, reports, and evidence.
Compliance.tf (CTF) Control:
codebuild_project_s3_logs_encryption_enabledAWS Config Managed Rule:
CODEBUILD_PROJECT_S3_LOGS_ENCRYPTEDCheckov Check:
CKV_AWS_311Powerpipe Control:
aws_compliance.control.codebuild_project_s3_logs_encryption_enabled