diff --git a/README.md b/README.md index 4a511ae8bf..36c075ca67 100644 --- a/README.md +++ b/README.md @@ -393,6 +393,7 @@ We are grateful to the community for contributing bugfixes and improvements! Ple | [cluster\_additional\_security\_group\_ids](#input\_cluster\_additional\_security\_group\_ids) | List of additional, externally created security group IDs to attach to the cluster control plane | `list(string)` | `[]` | no | | [cluster\_addons](#input\_cluster\_addons) | Map of cluster addon configurations to enable for the cluster. Addon name can be the map keys or set with `name` | `any` | `{}` | no | | [cluster\_addons\_timeouts](#input\_cluster\_addons\_timeouts) | Create, update, and delete timeout configurations for the cluster addons | `map(string)` | `{}` | no | +| [cluster\_cloudwatch\_log\_group\_use\_name\_prefix](#input\_cluster\_cloudwatch\_log\_group\_use\_name\_prefix) | Determines whether cluster cloudwatch log group name (`/aws/eks/${var.cluster_name}/cluster`) is used as a prefix | `bool` | `true` | no | | [cluster\_compute\_config](#input\_cluster\_compute\_config) | Configuration block for the cluster compute configuration | `any` | `{}` | no | | [cluster\_enabled\_log\_types](#input\_cluster\_enabled\_log\_types) | A list of the desired control plane logs to enable. For more information, see Amazon EKS Control Plane Logging documentation (https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html) | `list(string)` |
[| no | | [cluster\_encryption\_config](#input\_cluster\_encryption\_config) | Configuration block with encryption configuration for the cluster. To disable secret encryption, set this value to `{}` | `any` |
"audit",
"api",
"authenticator"
]
{
"resources": [
"secrets"
]
} | no |
diff --git a/main.tf b/main.tf
index c10d79608d..da6b61480e 100644
--- a/main.tf
+++ b/main.tf
@@ -203,7 +203,9 @@ resource "aws_ec2_tag" "cluster_primary_security_group" {
resource "aws_cloudwatch_log_group" "this" {
count = local.create && var.create_cloudwatch_log_group ? 1 : 0
- name = "/aws/eks/${var.cluster_name}/cluster"
+ name = var.cluster_cloudwatch_log_group_use_name_prefix ? null : "/aws/eks/${var.cluster_name}/cluster"
+ name_prefix = var.cluster_cloudwatch_log_group_use_name_prefix ? "/aws/eks/${var.cluster_name}/cluster${var.prefix_separator}" : null
+
retention_in_days = var.cloudwatch_log_group_retention_in_days
kms_key_id = var.cloudwatch_log_group_kms_key_id
log_group_class = var.cloudwatch_log_group_class
diff --git a/variables.tf b/variables.tf
index b4881b2988..088be280fb 100644
--- a/variables.tf
+++ b/variables.tf
@@ -299,6 +299,12 @@ variable "cloudwatch_log_group_tags" {
default = {}
}
+variable "cluster_cloudwatch_log_group_use_name_prefix" {
+ description = "Determines whether cluster cloudwatch log group name (`/aws/eks/$${var.cluster_name}/cluster`) is used as a prefix"
+ type = bool
+ default = true
+}
+
################################################################################
# Cluster Security Group
################################################################################