diff --git a/README.md b/README.md index a9550cb6..734480bb 100644 --- a/README.md +++ b/README.md @@ -404,6 +404,7 @@ Available targets: | name | Solution name, e.g. 'app' or 'jenkins' | string | `` | no | | namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no | | oidc_provider_enabled | Create an IAM OIDC identity provider for the cluster, then you can create IAM roles to associate with a service account in the cluster, instead of using kiam or kube2iam. For more information, see https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html | bool | `false` | no | +| public_access_cidrs | Indicates which CIDR blocks can access the Amazon EKS public API server endpoint when enabled. EKS defaults this to a list with 0.0.0.0/0. | list(string) | `` | no | | region | AWS Region | string | - | yes | | stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no | | subnet_ids | A list of subnet IDs to launch the cluster in | list(string) | - | yes | diff --git a/docs/terraform.md b/docs/terraform.md index 4802cd72..f1b840a1 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -33,6 +33,7 @@ | name | Solution name, e.g. 'app' or 'jenkins' | string | `` | no | | namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no | | oidc_provider_enabled | Create an IAM OIDC identity provider for the cluster, then you can create IAM roles to associate with a service account in the cluster, instead of using kiam or kube2iam. For more information, see https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html | bool | `false` | no | +| public_access_cidrs | Indicates which CIDR blocks can access the Amazon EKS public API server endpoint when enabled. EKS defaults this to a list with 0.0.0.0/0. | list(string) | `` | no | | region | AWS Region | string | - | yes | | stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no | | subnet_ids | A list of subnet IDs to launch the cluster in | list(string) | - | yes | diff --git a/main.tf b/main.tf index 8fb2e371..c341b272 100644 --- a/main.tf +++ b/main.tf @@ -115,6 +115,7 @@ resource "aws_eks_cluster" "default" { subnet_ids = var.subnet_ids endpoint_private_access = var.endpoint_private_access endpoint_public_access = var.endpoint_public_access + public_access_cidrs = var.public_access_cidrs } depends_on = [ diff --git a/variables.tf b/variables.tf index e2368269..85e7470c 100644 --- a/variables.tf +++ b/variables.tf @@ -113,6 +113,12 @@ variable "endpoint_public_access" { description = "Indicates whether or not the Amazon EKS public API server endpoint is enabled. Default to AWS EKS resource and it is true" } +variable "public_access_cidrs" { + type = list(string) + default = ["0.0.0.0/0"] + description = "Indicates which CIDR blocks can access the Amazon EKS public API server endpoint when enabled. EKS defaults this to a list with 0.0.0.0/0." +} + variable "enabled_cluster_log_types" { type = list(string) default = []