Skip to content

Commit

Permalink
Merge pull request #322 from kbst/eks-svc-cidr-default-null
Browse files Browse the repository at this point in the history
EKS: Allow configuring Service CIDR
  • Loading branch information
pst authored Oct 6, 2023
2 parents ca6a963 + 9c3a1b3 commit 81918aa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ jobs:
id-token: write # needed for keyless signing

steps:
- name: 'Free disk space'
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf $AGENT_TOOLSDIRECTORY
- name: 'Checkout'
uses: actions/checkout@v3

Expand Down
7 changes: 7 additions & 0 deletions aws/_modules/eks/master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ resource "aws_eks_cluster" "current" {
public_access_cidrs = var.cluster_public_access_cidrs
}

dynamic "kubernetes_network_config" {
for_each = var.cluster_service_cidr != null ? toset([1]) : toset([])
content {
service_ipv4_cidr = var.cluster_service_cidr
}
}

dynamic "encryption_config" {
for_each = var.cluster_encryption_key_arn != null ? toset([1]) : toset([])
content {
Expand Down
6 changes: 6 additions & 0 deletions aws/_modules/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ variable "cluster_public_access_cidrs" {
description = "List of CIDR blocks which can access the Amazon EKS public API server endpoint. EKS defaults this to a list with 0.0.0.0/0."
}

variable "cluster_service_cidr" {
type = string
default = null
description = "Sets the Service CIDR for the EKS cluster."
}

variable "cluster_encryption_key_arn" {
type = string
default = null
Expand Down
1 change: 1 addition & 0 deletions aws/cluster/configuration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ locals {
cluster_endpoint_public_access = lookup(local.cfg, "cluster_endpoint_public_access", true)
cluster_public_access_cidrs_lookup = lookup(local.cfg, "cluster_public_access_cidrs", null)
cluster_public_access_cidrs = local.cluster_public_access_cidrs_lookup == null ? null : split(",", local.cluster_public_access_cidrs_lookup)
cluster_service_cidr = lookup(local.cfg, "cluster_service_cidr", null)

cluster_encryption_key_arn = lookup(local.cfg, "cluster_encryption_key_arn", null)
}
1 change: 1 addition & 0 deletions aws/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module "cluster" {
cluster_endpoint_private_access = local.cluster_endpoint_private_access
cluster_endpoint_public_access = local.cluster_endpoint_public_access
cluster_public_access_cidrs = local.cluster_public_access_cidrs
cluster_service_cidr = local.cluster_service_cidr

cluster_encryption_key_arn = local.cluster_encryption_key_arn

Expand Down

0 comments on commit 81918aa

Please sign in to comment.