mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-04-25 10:08:25 +02:00
fix: add ip address when manage_aws_auth is true and public_access is false (#745)
This commit is contained in:
@@ -146,6 +146,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
|
||||
| cluster\_enabled\_log\_types | A list of the desired control plane logging 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 | Configuration block with encryption configuration for the cluster. See examples/secrets\_encryption/main.tf for example format | <pre>list(object({<br> provider_key_arn = string<br> resources = list(string)<br> }))</pre> | `[]` | no |
|
||||
| cluster\_endpoint\_private\_access | Indicates whether or not the Amazon EKS private API server endpoint is enabled. | `bool` | `false` | no |
|
||||
| cluster\_endpoint\_private\_access\_cidrs | List of CIDR blocks which can access the Amazon EKS private API server endpoint, when public access is disabled | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
|
||||
| cluster\_endpoint\_public\_access | Indicates whether or not the Amazon EKS public API server endpoint is enabled. | `bool` | `true` | no |
|
||||
| cluster\_endpoint\_public\_access\_cidrs | List of CIDR blocks which can access the Amazon EKS public API server endpoint. | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
|
||||
| cluster\_iam\_role\_name | IAM role name for the cluster. Only applicable if manage\_cluster\_iam\_resources is set to false. | `string` | `""` | no |
|
||||
|
||||
12
cluster.tf
12
cluster.tf
@@ -45,6 +45,18 @@ resource "aws_eks_cluster" "this" {
|
||||
]
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "cluster_private_access" {
|
||||
count = var.create_eks && var.manage_aws_auth && var.cluster_endpoint_private_access && var.cluster_endpoint_public_access == false ? 1 : 0
|
||||
type = "ingress"
|
||||
from_port = 443
|
||||
to_port = 443
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.cluster_endpoint_private_access_cidrs
|
||||
|
||||
security_group_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
|
||||
}
|
||||
|
||||
|
||||
resource "null_resource" "wait_for_cluster" {
|
||||
count = var.create_eks && var.manage_aws_auth ? 1 : 0
|
||||
|
||||
|
||||
@@ -234,6 +234,12 @@ variable "iam_path" {
|
||||
default = "/"
|
||||
}
|
||||
|
||||
variable "cluster_endpoint_private_access_cidrs" {
|
||||
description = "List of CIDR blocks which can access the Amazon EKS private API server endpoint, when public access is disabled"
|
||||
type = list(string)
|
||||
default = ["0.0.0.0/0"]
|
||||
}
|
||||
|
||||
variable "cluster_endpoint_private_access" {
|
||||
description = "Indicates whether or not the Amazon EKS private API server endpoint is enabled."
|
||||
type = bool
|
||||
|
||||
Reference in New Issue
Block a user