From aab9d26baec7e0dd848cc90890aa04dc53aa5794 Mon Sep 17 00:00:00 2001 From: Lee Wilmott Date: Wed, 15 Feb 2023 23:05:08 +0000 Subject: [PATCH 1/2] aws_cloudwatch_log_group: Allow a three year retention period (1096 days) --- .changelog/29423.txt | 3 +++ internal/service/logs/group.go | 2 +- internal/service/logs/group_test.go | 7 +++++++ website/docs/r/cloudwatch_log_group.html.markdown | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .changelog/29423.txt diff --git a/.changelog/29423.txt b/.changelog/29423.txt new file mode 100644 index 000000000000..e1d88e281b68 --- /dev/null +++ b/.changelog/29423.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_cloudwatch_log_group: Allow `retention_in_days` attribute to accept a three year retention period (1096 days) +``` \ No newline at end of file diff --git a/internal/service/logs/group.go b/internal/service/logs/group.go index 7ba9e574646d..822ef5e9cd76 100644 --- a/internal/service/logs/group.go +++ b/internal/service/logs/group.go @@ -61,7 +61,7 @@ func resourceGroup() *schema.Resource { Type: schema.TypeInt, Optional: true, Default: 0, - ValidateFunc: validation.IntInSlice([]int{0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, 3653}), + ValidateFunc: validation.IntInSlice([]int{0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653}), }, "skip_destroy": { Type: schema.TypeBool, diff --git a/internal/service/logs/group_test.go b/internal/service/logs/group_test.go index 0aafe3b8f18e..8ce22841ed0b 100644 --- a/internal/service/logs/group_test.go +++ b/internal/service/logs/group_test.go @@ -241,6 +241,13 @@ func TestAccLogsGroup_retentionPolicy(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "retention_in_days", "365"), ), }, + { + Config: testAccGroupConfig_retentionPolicy(rName, 1096), + Check: resource.ComposeTestCheckFunc( + testAccCheckGroupExists(ctx, t, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "retention_in_days", "1096"), + ), + }, { ResourceName: resourceName, ImportState: true, diff --git a/website/docs/r/cloudwatch_log_group.html.markdown b/website/docs/r/cloudwatch_log_group.html.markdown index 81a89e7a5d99..52b6b67a25c5 100644 --- a/website/docs/r/cloudwatch_log_group.html.markdown +++ b/website/docs/r/cloudwatch_log_group.html.markdown @@ -31,7 +31,7 @@ The following arguments are supported: * `name_prefix` - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with `name`. * `skip_destroy` - (Optional) Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state. * `retention_in_days` - (Optional) Specifies the number of days - you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, 3653, and 0. + you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653, and 0. If you select 0, the events in the log group are always retained and never expire. * `kms_key_id` - (Optional) The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires From 9e4a1ba154bcb58a491c73b6b57f90c31e3de2d6 Mon Sep 17 00:00:00 2001 From: Lee Wilmott Date: Thu, 16 Feb 2023 09:09:40 +0000 Subject: [PATCH 2/2] Correct filename of ChangeLog entry --- .changelog/{29423.txt => 29426.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .changelog/{29423.txt => 29426.txt} (100%) diff --git a/.changelog/29423.txt b/.changelog/29426.txt similarity index 100% rename from .changelog/29423.txt rename to .changelog/29426.txt