diff --git a/.changelog/29426.txt b/.changelog/29426.txt new file mode 100644 index 000000000000..e1d88e281b68 --- /dev/null +++ b/.changelog/29426.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