Skip to content

Commit

Permalink
Merge pull request #15 from companieshouse/feature/cloudwatch-log-group
Browse files Browse the repository at this point in the history
Add CloudWatch log group for agent logs
  • Loading branch information
marcransome authored Apr 19, 2021
2 parents 7bd0419 + 055ef31 commit 1f0e900
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion groups/frontend/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module "instance_profile" {
source = "[email protected]:companieshouse/terraform-modules//aws/instance_profile?ref=tags/1.0.62"
name = "tuxedo-frontend-profile"

cw_log_group_arns = [for log_group in merge(aws_cloudwatch_log_group.tuxedo, aws_cloudwatch_log_group.ngsrv) : log_group.arn]
cw_log_group_arns = [for log_group in merge(aws_cloudwatch_log_group.tuxedo, aws_cloudwatch_log_group.ngsrv, {"cloudwatch" = aws_cloudwatch_log_group.cloudwatch}) : log_group.arn]
enable_SSM = true
kms_key_refs = [
local.ssm_kms_key_id
Expand Down
10 changes: 10 additions & 0 deletions groups/frontend/logs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ resource "aws_cloudwatch_log_group" "ngsrv" {
nGsrvLogName = each.value.log_name
})
}

resource "aws_cloudwatch_log_group" "cloudwatch" {
name = "${var.service_subtype}-${var.service}-cloudwatch"
retention_in_days = var.default_log_retention_in_days
kms_key_id = local.logs_kms_key_id

tags = merge(local.common_tags, {
LogName = "cloudwatch"
})
}

0 comments on commit 1f0e900

Please sign in to comment.