Enable log retention for cloudwatch log groups (#387)

* enable log retention for cloudwatch log groups

* revert version bump

* set default retention to 90 days
This commit is contained in:
Yurii Polishchuk
2019-06-13 11:03:34 +03:00
committed by Max Williams
parent 758fdab1ee
commit bf5dae00e1
4 changed files with 16 additions and 0 deletions

View File

@@ -1,3 +1,10 @@
resource "aws_cloudwatch_log_group" "this" {
name = "/aws/eks/${var.cluster_name}/cluster"
retention_in_days = "${var.cluster_log_retention_in_days}"
count = "${length(var.cluster_enabled_log_types) > 0 ? 1 : 0}"
}
resource "aws_eks_cluster" "this" {
name = "${var.cluster_name}"
enabled_cluster_log_types = "${var.cluster_enabled_log_types}"
@@ -19,6 +26,7 @@ resource "aws_eks_cluster" "this" {
depends_on = [
"aws_iam_role_policy_attachment.cluster_AmazonEKSClusterPolicy",
"aws_iam_role_policy_attachment.cluster_AmazonEKSServicePolicy",
"aws_cloudwatch_log_group.this",
]
}