Skip to content

Commit

Permalink
Merge pull request #29426 from leewilmott/f-29423_aws_cloudwatch_log_…
Browse files Browse the repository at this point in the history
…group_allow_three_year_retention

aws_cloudwatch_log_group: Allow a three year retention period (1096 days)
  • Loading branch information
ewbankkit committed Feb 16, 2023
2 parents c95ffc6 + 9e4a1ba commit cfb1f82
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/29426.txt
Original file line number Diff line number Diff line change
@@ -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)
```
2 changes: 1 addition & 1 deletion internal/service/logs/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions internal/service/logs/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/cloudwatch_log_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cfb1f82

Please sign in to comment.