Skip to content

Commit df023e1

Browse files
authored
Merge pull request #8 from SPHTech-Platform/enable-log-configuration
[PES-974] Enable CloudWatch logs
1 parent 418a8f8 commit df023e1

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
| Name | Version |
1414
|------|---------|
15-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.24.0 |
15+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.94.1 |
1616

1717
## Modules
1818

@@ -46,6 +46,7 @@
4646
| <a name="input_build_type"></a> [build\_type](#input\_build\_type) | Type of build environment to use for related builds. | `string` | `"LINUX_CONTAINER"` | no |
4747
| <a name="input_buildspec"></a> [buildspec](#input\_buildspec) | The build spec declaration to use for this build project's related builds. | `string` | `""` | no |
4848
| <a name="input_cache"></a> [cache](#input\_cache) | Cache configuration block. | <pre>object({<br> type = optional(string) # Valid values: NO_CACHE, LOCAL, S3. Defaults to NO_CACHE.<br> modes = optional(list(string)) # Required when cache type is LOCAL<br> location = optional(string) # Required when cache type is S3<br> })</pre> | `{}` | no |
49+
| <a name="input_cloudwatch_log_group"></a> [cloudwatch\_log\_group](#input\_cloudwatch\_log\_group) | Custom log group for CodeBuild Project | `string` | `null` | no |
4950
| <a name="input_create_service_role"></a> [create\_service\_role](#input\_create\_service\_role) | Create new IAM service role and policy if `true`. | `bool` | `true` | no |
5051
| <a name="input_description"></a> [description](#input\_description) | Short description of the project. | `string` | n/a | yes |
5152
| <a name="input_encryption_key_arn"></a> [encryption\_key\_arn](#input\_encryption\_key\_arn) | AWS Key Management Service (AWS KMS) customer master key (CMK) to be used for encrypting the build project's build output artifacts. | `string` | `null` | no |

iam.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module "codebuild_service_role" {
2+
#checkov:skip=CKV_TF_1:Ensure Terraform module sources use a commit hash
23
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role"
34
version = "~> 5.2.0"
45

@@ -17,6 +18,7 @@ module "codebuild_service_role" {
1718
}
1819

1920
module "codebuild_service_role_policy" {
21+
#checkov:skip=CKV_TF_1:Ensure Terraform module sources use a commit hash
2022
source = "terraform-aws-modules/iam/aws//modules/iam-policy"
2123
version = "~> 5.2.0"
2224

main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,11 @@ resource "aws_codebuild_project" "this" {
4242
location = var.source_location
4343
report_build_status = var.report_build_status
4444
}
45+
46+
logs_config {
47+
cloudwatch_logs {
48+
group_name = var.cloudwatch_log_group != null && var.cloudwatch_log_group != "" ? var.cloudwatch_log_group : null
49+
status = "ENABLED"
50+
}
51+
}
4552
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,9 @@ variable "additional_iam" {
140140
type = list(any)
141141
default = []
142142
}
143+
144+
variable "cloudwatch_log_group" {
145+
description = "Custom log group for CodeBuild Project"
146+
type = string
147+
default = null
148+
}

0 commit comments

Comments
 (0)