CodeBuild projects should have logging enabled¶
This control checks if an AWS CodeBuild project environment has at least one log option enabled. The rule is non-compliant if the status of all present log configurations is set to 'DISABLED'.
How to fix¶
Attribute logs_config[0].cloudwatch_logs[0].status of aws_codebuild_project must be non-empty.
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"
}
logs_config {
cloudwatch_logs {
status = "ENABLED"
}
}
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"
}
}
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_logging_enabledAWS Config Managed Rule:
CODEBUILD_PROJECT_LOGGING_ENABLEDCheckov Check:
CKV_AWS_314Powerpipe Control:
aws_compliance.control.codebuild_project_logging_enabled