Skip to content

Commit

Permalink
feat: allow custom logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiFleKs committed Jun 4, 2019
1 parent 5466dbb commit 3d5ea7a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
14 changes: 13 additions & 1 deletion terraform/modules/eks/eks-cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ resource "aws_security_group_rule" "eks-cluster-ingress-node-https" {
}

resource "aws_security_group_rule" "eks-cluster-ingress-workstation-https" {
cidr_blocks = ["0.0.0.0/0"]
cidr_blocks = "${var.allowed_cidr_blocks}"
description = "Allow workstation to communicate with the cluster API Server"
from_port = 443
protocol = "tcp"
Expand All @@ -71,13 +71,25 @@ resource "aws_security_group_rule" "eks-cluster-ingress-workstation-https" {
type = "ingress"
}

resource "aws_cloudwatch_log_group" "eks-logs" {
name = "/aws/eks/${var.cluster-name}/cluster"
retention_in_days = "${var.cluster_log_retention_in_days}"
}

resource "aws_eks_cluster" "eks" {

depends_on = ["aws_cloudwatch_log_group.eks-logs"]

name = "${var.cluster-name}"
role_arn = "${aws_iam_role.eks-cluster.arn}"

enabled_cluster_log_types = "${var.enabled_cluster_log_types}"

vpc_config {
security_group_ids = ["${aws_security_group.eks-cluster.id}"]
subnet_ids = ["${split(",", var.vpc["create"] ? join(",", concat(aws_subnet.eks-private.*.id, aws_subnet.eks.*.id)) : join(",", concat(split(",", var.vpc["private_subnets_id"]),split(",", var.vpc["public_subnets_id"]))))}"]
endpoint_private_access = "${var.endpoint_private_access}"
endpoint_public_access = "${var.endpoint_public_access}"
}

version = "${var.kubernetes_version}"
Expand Down
27 changes: 27 additions & 0 deletions terraform/modules/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ variable "node-pools" {
type = "list"
}

variable "node-pools-tags" {
default = []
type = "list"
}

variable "domain_name" {
description = "Domain name of the parent domain where subdomain is created"
default = "domain.tld"
Expand Down Expand Up @@ -86,3 +91,25 @@ variable "cni_metrics_helper" {
type = "map"
default = {}
}

variable "endpoint_public_access" {
default = true
}

variable "endpoint_private_access" {
default = false
}

variable "enabled_cluster_log_types" {
type = "list"
default = []
}

variable "cluster_log_retention_in_days" {
default = 30
}

variable "allowed_cidr_blocks" {
type = "list"
default = ["0.0.0.0/0"]
}

0 comments on commit 3d5ea7a

Please sign in to comment.