Skip to content

Commit

Permalink
Merge pull request #39 from RADAR-base/custom-vpc-config
Browse files Browse the repository at this point in the history
Allow VPC subnet and CIDR to be configured
  • Loading branch information
keyvaann authored Dec 30, 2024
2 parents 6b6914d + 5533594 commit 2e45f2d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
3 changes: 3 additions & 0 deletions cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
| <a name="input_environment"></a> [environment](#input\_environment) | Environment name | `string` | `"dev"` | no |
| <a name="input_instance_capacity_type"></a> [instance\_capacity\_type](#input\_instance\_capacity\_type) | Capacity type used by EKS managed node groups | `string` | `"SPOT"` | no |
| <a name="input_instance_types"></a> [instance\_types](#input\_instance\_types) | List of instance types used by EKS managed node groups | `list(any)` | <pre>[<br/> "m5.large",<br/> "m5d.large",<br/> "m5a.large",<br/> "m5ad.large",<br/> "m4.large"<br/>]</pre> | no |
| <a name="input_vpc_cidr"></a> [vpc\_cidr](#input\_vpc\_cidr) | VPC CIDR | `string` | `"10.0.0.0/16"` | no |
| <a name="input_vpc_private_subnet_cidr"></a> [vpc\_private\_subnet\_cidr](#input\_vpc\_private\_subnet\_cidr) | List of private subnet configurations | `list(any)` | <pre>[<br/> "10.0.0.0/19",<br/> "10.0.32.0/19",<br/> "10.0.64.0/19"<br/>]</pre> | no |
| <a name="input_vpc_public_subnet_cidr"></a> [vpc\_public\_subnet\_cidr](#input\_vpc\_public\_subnet\_cidr) | List of public subnet configurations | `list(any)` | <pre>[<br/> "10.0.96.0/19",<br/> "10.0.128.0/19",<br/> "10.0.160.0/19"<br/>]</pre> | no |
| <a name="input_worker_node_size"></a> [worker\_node\_size](#input\_worker\_node\_size) | Node size of the worker node group | `map(number)` | <pre>{<br/> "desired": 2,<br/> "max": 10,<br/> "min": 0<br/>}</pre> | no |

## Outputs
Expand Down
26 changes: 26 additions & 0 deletions cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,32 @@ variable "dmz_node_size" {
}
}

variable "vpc_cidr" {
type = string
description = "VPC CIDR"
default = "10.0.0.0/16"
}

variable "vpc_private_subnet_cidr" {
description = "List of private subnet configurations"
type = list(any)
default = [
"10.0.0.0/19",
"10.0.32.0/19",
"10.0.64.0/19",
]
}

variable "vpc_public_subnet_cidr" {
description = "List of public subnet configurations"
type = list(any)
default = [
"10.0.96.0/19",
"10.0.128.0/19",
"10.0.160.0/19",
]
}

variable "default_storage_class" {
type = string
description = "Default storage class used for describing the EBS usage"
Expand Down
15 changes: 3 additions & 12 deletions cluster/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,16 @@ module "vpc" {
version = "~> 5.0"

name = "${var.eks_cluster_name}-vpc"
cidr = "10.0.0.0/16"
cidr = var.vpc_cidr

azs = [
"${var.AWS_REGION}a",
"${var.AWS_REGION}b",
"${var.AWS_REGION}c",
]

private_subnets = [
"10.0.0.0/19",
"10.0.32.0/19",
"10.0.64.0/19",
]

public_subnets = [
"10.0.96.0/19",
"10.0.128.0/19",
"10.0.160.0/19",
]
private_subnets = var.vpc_private_subnet_cidr
public_subnets = var.vpc_public_subnet_cidr

public_subnet_tags = {
"kubernetes.io/role/elb" = "1"
Expand Down

0 comments on commit 2e45f2d

Please sign in to comment.