From 789024783e65f6f3eb89e7c2b0d62fc6c2f130f1 Mon Sep 17 00:00:00 2001 From: abhinavkumarsph <122246745+abhinavkumarsph@users.noreply.github.com> Date: Fri, 9 Feb 2024 10:02:37 +0800 Subject: [PATCH] variable for log group retention period (#30) --- README.md | 7 +++++-- cloudwatch.tf | 2 +- variables.tf | 5 +++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5c24dcc..427ba27 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.4 | +| [terraform](#requirement\_terraform) | >= 1.4 | | [aws](#requirement\_aws) | >= 4.38 | ## Providers @@ -39,12 +39,13 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [access\_policies](#input\_access\_policies) | IAM policy document specifying the access policies for the domain | `string` | `""` | no | -| [admin\_identifiers](#input\_admin\_identifiers) | Admin Identifiers to be allowed in the Access Policy of Opensearch Cluster | `list(string)` | `["*"]` | no | +| [admin\_identifiers](#input\_admin\_identifiers) | Admin Identifiers to be allowed in the Access Policy of Opensearch Cluster | `list(string)` |
[| no | | [advanced\_security\_options\_enabled](#input\_advanced\_security\_options\_enabled) | Whether advanced security is enabled | `bool` | `false` | no | | [alarm\_actions](#input\_alarm\_actions) | The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN) | `list(string)` | `[]` | no | | [anonymous\_auth\_enabled](#input\_anonymous\_auth\_enabled) | Whether Anonymous auth is enabled. Enables fine-grained access control on an existing domain. Ignored unless advanced\_security\_options are enabled. Can only be enabled on an existing domain | `bool` | `false` | no | | [auto\_tune\_desired\_state](#input\_auto\_tune\_desired\_state) | The Auto-Tune desired state for the domain. Valid values: ENABLED or DISABLED | `string` | `"ENABLED"` | no | | [availability\_zones](#input\_availability\_zones) | The number of availability zones for the OpenSearch cluster. Valid values: 1, 2 or 3. | `number` | `3` | no | +| [cloudwatch\_log\_group\_retention\_days](#input\_cloudwatch\_log\_group\_retention\_days) | Cloudwatch log group retention period in days | `number` | `7` | no | | [cold\_storage\_enabled](#input\_cold\_storage\_enabled) | Enable cold storage. Master and ultrawarm nodes must be enabled for cold storage. | `bool` | `false` | no | | [create\_service\_role](#input\_create\_service\_role) | Indicates whether to create the service-linked role. See https://docs.aws.amazon.com/opensearch-service/latest/developerguide/slr.html | `bool` | `false` | no | | [custom\_endpoint](#input\_custom\_endpoint) | Custom Endpoint URL | `string` | `null` | no | @@ -63,6 +64,7 @@ No modules. | [instance\_type](#input\_instance\_type) | The type of EC2 instances to run for each hot node. A list of available instance types can you find at https://aws.amazon.com/en/opensearch-service/pricing/#On-Demand_instance_pricing | `string` | `"t3.small.search"` | no | | [internal\_user\_database\_enabled](#input\_internal\_user\_database\_enabled) | Whether the internal user database is enabled | `bool` | `false` | no | | [log\_publishing\_options](#input\_log\_publishing\_options) | Configuration block for publishing slow and application logs to CloudWatch Logs. |
"*"
]
map(object({| `{}` | no | +| [maintenance\_schedule](#input\_maintenance\_schedule) | configuration for auto tune maintenance schedule | `map(any)` | `{}` | no | | [master\_instance\_count](#input\_master\_instance\_count) | The number of dedicated master nodes in the cluster. | `number` | `3` | no | | [master\_instance\_enabled](#input\_master\_instance\_enabled) | Indicates whether dedicated master nodes are enabled for the cluster. | `bool` | `true` | no | | [master\_instance\_type](#input\_master\_instance\_type) | The type of EC2 instances to run for each master node. A list of available instance types can you find at https://aws.amazon.com/en/opensearch-service/pricing/#On-Demand_instance_pricing | `string` | `"t3.small.search"` | no | @@ -74,6 +76,7 @@ No modules. | [red\_cluster\_status\_evaluation\_periods](#input\_red\_cluster\_status\_evaluation\_periods) | The number of periods over which data is compared to the specified threshold | `number` | `1` | no | | [red\_cluster\_status\_period](#input\_red\_cluster\_status\_period) | The period in seconds over which the specified statistic is applied | `number` | `60` | no | | [red\_cluster\_status\_threshold](#input\_red\_cluster\_status\_threshold) | The value against which the specified statistic is compared. This parameter is required for alarms based on static thresholds, but should not be used for alarms based on anomaly detection models | `number` | `1` | no | +| [rollback\_on\_disable](#input\_rollback\_on\_disable) | whether to roll back auto tune if auto tune is disabled | `string` | `"NO_ROLLBACK"` | no | | [saml\_enabled](#input\_saml\_enabled) | Whether SAML authentication is enabled | `bool` | `false` | no | | [saml\_entity\_id](#input\_saml\_entity\_id) | The unique Entity ID of the application in SAML Identity Provider. | `string` | `""` | no | | [saml\_master\_backend\_role](#input\_saml\_master\_backend\_role) | This backend role receives full permissions to the cluster, equivalent to a new master role, but can only use those permissions within Dashboards. | `string` | `null` | no | diff --git a/cloudwatch.tf b/cloudwatch.tf index 1df9953..5dea72c 100644 --- a/cloudwatch.tf +++ b/cloudwatch.tf @@ -8,7 +8,7 @@ resource "aws_cloudwatch_log_group" "aos" { for_each = { for k, v in local.log_publishing_options : k => v if v.enabled } name = "${local.log_prefix}/${each.key}" - retention_in_days = 7 + retention_in_days = var.cloudwatch_log_group_retention_days } data "aws_iam_policy_document" "aos_log_publishing" { diff --git a/variables.tf b/variables.tf index c301a72..1dcf2ac 100644 --- a/variables.tf +++ b/variables.tf @@ -309,6 +309,11 @@ variable "log_publishing_options" { default = {} } +variable "cloudwatch_log_group_retention_days" { + description = "Cloudwatch log group retention period in days" + type = number + default = 7 +} ############ ## Alerts ##
enabled = optional(bool, true)
cloudwatch_log_group_arn = optional(string, "")
}))