Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit 8a0bea2

Browse files
authored
EKS Upgrade + Subnet changes (#115)
1 parent 29fb912 commit 8a0bea2

6 files changed

Lines changed: 38 additions & 5 deletions

File tree

modules/aws/eks/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,24 @@ locals {
3131
instance_types = [v.instance_type]
3232
name_prefix = "${v.ng_name}-art-"
3333
version = var.cluster.version
34+
#subnets = var.vpc.private_secondary_subnets != null ? var.vpc.private_secondary_subnets : var.vpc.subnets
35+
subnets = length(data.aws_subnets.private_secondary.ids) > 0 ? data.aws_subnets.private_secondary.ids : var.vpc.subnets
3436
k8s_labels = merge(v.k8s_labels, { Environment = var.env })
3537
}, v)}
3638
}
3739

40+
##Read the secondary subnets
41+
data "aws_subnets" "private_secondary" {
42+
filter {
43+
name = "vpc-id"
44+
values = [var.vpc.id]
45+
}
46+
47+
tags = {
48+
Type = "private_secondary"
49+
}
50+
}
51+
3852
module "eks" {
3953
source = "github.com/argonautdev/terraform-eks?ref=v17.4.1"
4054
cluster_name = var.cluster.name

modules/aws/eks/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ variable "vpc" {
4040
name = string
4141
id = string
4242
subnets = list(string)
43+
private_secondary_subnets = optional(list(string))
4344
})
4445
}
4546

modules/aws/vpc/default/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
data "aws_availability_zones" "available" {}
22

33
module "vpc" {
4-
source = "terraform-aws-modules/vpc/aws"
5-
version = "v3.11.0"
4+
source = "github.com/argonautdev/terraform-aws-vpc?ref=v5.1.1"
65

76
name = var.name
87
# cidr = "10.0.0.0/16"
@@ -13,16 +12,17 @@ module "vpc" {
1312
// public_subnets = slice(var.public_subnet_cidr_blocks, 0, var.public_subnet_count)
1413
public_subnets = var.public_subnet_cidr_blocks
1514
private_subnets = var.private_subnet_cidr_blocks
15+
private_secondary_subnets = var.secondary_cidr_subnet_blocks
1616
database_subnets = var.database_subnet_cidr_blocks
1717
elasticache_subnets = var.elasticache_subnet_cidr_blocks
1818
# redshift_subnets = ["20.10.41.0/24", "20.10.42.0/24", "20.10.43.0/24"]
1919
# intra_subnets = ["20.10.51.0/24", "20.10.52.0/24", "20.10.53.0/24"]
2020
create_database_subnet_group = true
2121
create_elasticache_subnet_group = true
2222
// create_private_subnet_group = true
23-
23+
secondary_cidr_blocks = var.secondary_cidr_blocks
24+
2425

25-
2626
manage_default_route_table = true
2727
default_route_table_tags = { DefaultRouteTable = true }
2828

modules/aws/vpc/default/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ output "database_subnets" {
2626
output "elasticache_subnets" {
2727
value = module.vpc.elasticache_subnets
2828
}
29+
30+
output "private_secondary_subnets" {
31+
value = module.vpc.private_secondary_subnets
32+
}

modules/aws/vpc/default/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = "~> 4.67.0"
7+
version = "~> 5.0.0"
88
}
99
}
1010
}

modules/aws/vpc/default/variables.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ variable "enable_vpn_gateway" {
2323
type = bool
2424
}
2525

26+
variable "secondary_cidr_blocks" {
27+
description = "List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool"
28+
type = list(string)
29+
default = ["10.10.0.0/16"]
30+
}
31+
32+
variable "secondary_cidr_subnet_blocks" {
33+
description = "List of secondary subnet CIDR blocks to associate with the VPC to extend the IP Address pool"
34+
type = list(string)
35+
# default = []
36+
default = ["10.10.0.0/18", "10.10.64.0/18", "10.10.128.0/18" ]
37+
}
38+
39+
2640
variable "enable_dns_hostnames" {
2741
description = "Enable DNS hostnames in the VPC."
2842
type = bool

0 commit comments

Comments
 (0)