Skip to content

Commit c0726f8

Browse files
Merge pull request #46 from bti360/configurable-workstation-cidr
Configurable workstation cidr
2 parents 6f25185 + 1200345 commit c0726f8

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
106106
| worker_security_group_id | If provided, all workers will be attached to this security group. If not given, a security group will be created with necessary ingres/egress to work with the EKS cluster. | string | `` | no |
107107
| worker_sg_ingress_from_port | Minimum port number from which pods will accept communication. Must be changed to a lower value if some pods in your cluster will expose a port lower than 1025 (e.g. 22, 80, or 443). | string | `1025` | no |
108108
| workers_group_defaults | Default values for target groups as defined by the list of maps. | map | `<map>` | no |
109+
| workstation_cidr | Override the default ingress rule that allows communication with the EKS cluster API. If not given, will use current IP/32. | string | - | no |
109110

110111
## Outputs
111112

cluster.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ resource "aws_security_group_rule" "cluster_https_worker_ingress" {
4545
}
4646

4747
resource "aws_security_group_rule" "cluster_https_cidr_ingress" {
48-
cidr_blocks = ["${local.workstation_external_cidr}"]
48+
cidr_blocks = ["${local.workstation_cidr}"]
4949
description = "Allow kubectl communication with the EKS cluster API."
5050
protocol = "tcp"
5151
security_group_id = "${aws_security_group.cluster.id}"

local.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ locals {
33
cluster_security_group_id = "${var.cluster_security_group_id == "" ? aws_security_group.cluster.id : var.cluster_security_group_id}"
44
worker_security_group_id = "${var.worker_security_group_id == "" ? aws_security_group.workers.id : var.worker_security_group_id}"
55
workstation_external_cidr = "${chomp(data.http.workstation_external_ip.body)}/32"
6+
workstation_cidr = "${coalesce(var.workstation_cidr, local.workstation_external_cidr)}"
67

78
# Mapping from the node type that we selected and the max number of pods that it can run
89
# Taken from https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-06-05/amazon-eks-nodegroup.yaml

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ variable "cluster_security_group_id" {
77
default = ""
88
}
99

10+
variable "workstation_cidr" {
11+
description = "Override the default ingress rule that allows communication with the EKS cluster API. If not given, will use current IP/32. "
12+
default = ""
13+
}
14+
1015
variable "cluster_version" {
1116
description = "Kubernetes version to use for the EKS cluster."
1217
default = "1.10"

0 commit comments

Comments
 (0)