Skip to content

Commit

Permalink
Merge pull request #41734 from hashicorp/security-terraform.aws.secur…
Browse files Browse the repository at this point in the history
…ity.aws-cloudwatch-log-group-no-retention.aws-cloudwatch-log-group-no-retention

Fix `terraform.aws.security.aws-cloudwatch-log-group-no-retention.aws-cloudwatch-log-group-no-retention` security findings
  • Loading branch information
ewbankkit authored Mar 7, 2025
2 parents 1dcc5d7 + 00492e9 commit e713509
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/ecs-alb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,11 @@ resource "aws_alb_listener" "front_end" {
## CloudWatch Logs

resource "aws_cloudwatch_log_group" "ecs" {
name = "tf-ecs-group/ecs-agent"
name = "tf-ecs-group/ecs-agent"
retention_in_days = 1
}

resource "aws_cloudwatch_log_group" "app" {
name = "tf-ecs-group/app-ghost"
name = "tf-ecs-group/app-ghost"
retention_in_days = 1
}
2 changes: 2 additions & 0 deletions internal/service/logs/testdata/LogGroup/data.tags/main_gen.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ data "aws_cloudwatch_log_group" "test" {
resource "aws_cloudwatch_log_group" "test" {
name = var.rName

retention_in_days = 1

tags = var.resource_tags
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ data "aws_cloudwatch_log_group" "test" {
resource "aws_cloudwatch_log_group" "test" {
name = var.rName

retention_in_days = 1

tags = var.resource_tags
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ data "aws_cloudwatch_log_group" "test" {
resource "aws_cloudwatch_log_group" "test" {
name = var.rName

retention_in_days = 1

tags = var.resource_tags
}

Expand Down
2 changes: 2 additions & 0 deletions internal/service/logs/testdata/LogGroup/tags/main_gen.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
resource "aws_cloudwatch_log_group" "test" {
name = var.rName

retention_in_days = 1

tags = var.resource_tags
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ provider "null" {}
resource "aws_cloudwatch_log_group" "test" {
name = var.rName

retention_in_days = 1

tags = {
(var.unknownTagKey) = null_resource.test.id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ provider "null" {}
resource "aws_cloudwatch_log_group" "test" {
name = var.rName

retention_in_days = 1

tags = {
(var.unknownTagKey) = null_resource.test.id
(var.knownTagKey) = var.knownTagValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ provider "aws" {
resource "aws_cloudwatch_log_group" "test" {
name = var.rName

retention_in_days = 1

tags = var.resource_tags
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ provider "aws" {
resource "aws_cloudwatch_log_group" "test" {
name = var.rName

retention_in_days = 1

tags = var.resource_tags
}

Expand Down
2 changes: 2 additions & 0 deletions internal/service/logs/testdata/tmpl/group_tags.gtpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
resource "aws_cloudwatch_log_group" "test" {
name = var.rName

retention_in_days = 1

{{- template "tags" . }}
}

0 comments on commit e713509

Please sign in to comment.