Skip to content

Commit

Permalink
CDPAUTO-102 Improve subnet CIDR calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsgaspar committed Aug 7, 2023
1 parent beda186 commit c55b538
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 9 deletions.
4 changes: 3 additions & 1 deletion modules/terraform-cdp-aws-pre-reqs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ module "aws_cdp_vpc" {
private_network_extensions = var.private_network_extensions
env_prefix = var.env_prefix
tags = local.env_tags


private_cidr_range = var.private_cidr_range
public_cidr_range = var.public_cidr_range
}

# ------- Security Groups -------
Expand Down
4 changes: 0 additions & 4 deletions modules/terraform-cdp-aws-pre-reqs/modules/vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ variable "vpc_cidr" {
variable "private_cidr_range" {
type = number
description = "Size of each private subnet"

default = 19
}

variable "public_cidr_range" {
type = number
description = "Size of each public subnet"

default = 24
}

variable "tags" {
Expand Down
16 changes: 15 additions & 1 deletion modules/terraform-cdp-aws-pre-reqs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,25 @@ variable "create_vpc" {

variable "vpc_cidr" {
type = string
description = "VPC CIDR Block"
description = "VPC CIDR Block. Required if create_vpc is true."

default = "10.10.0.0/16"
}

variable "private_cidr_range" {
type = number
description = "Size of each private subnet. Required if create_vpc is true. Number of subnets will be automatically selected to match on the number of Availability Zones in the selected AWS region. (Depending on the selected deployment pattern, one subnet will be created per region.)"

default = 19
}

variable "public_cidr_range" {
type = number
description = "Size of each public subnet. Required if create_vpc is true. Number of subnets will be automatically selected to match on the number of Availability Zones in the selected AWS region. (Depending on the selected deployment pattern, one subnet will be created per region.)"

default = 24
}

variable "private_network_extensions" {
type = bool

Expand Down
4 changes: 4 additions & 0 deletions modules/terraform-cdp-azure-pre-reqs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ module "azure_cdp_vnet" {

env_prefix = var.env_prefix
tags = local.env_tags

cdp_subnet_range = var.cdp_subnet_range
gateway_subnet_range = var.gateway_subnet_range

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ variable "cdp_subnet_range" {
type = number
description = "Size of each (internal) cluster subnet"

default = 19
}

variable "gateway_subnet_range" {
type = number
description = "Size of each gateway subnet"

default = 24
}

variable "vnet_region" {
Expand Down
16 changes: 15 additions & 1 deletion modules/terraform-cdp-azure-pre-reqs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,25 @@ variable "vnet_name" {

variable "vnet_cidr" {
type = string
description = "VNet CIDR Block"
description = "VNet CIDR Block. Required if create_vpc is true."

default = "10.10.0.0/16"
}

variable "cdp_subnet_range" {
type = number
description = "Size of each (internal) cluster subnet. Required if create_vpc is true."

default = 19
}

variable "gateway_subnet_range" {
type = number
description = "Size of each gateway subnet. Required if create_vpc is true."

default = 24
}

variable "cdp_resourcegroup_name" {
type = string
description = "Pre-existing Resource Group for CDP environment. Required if create_vnet is false."
Expand Down

0 comments on commit c55b538

Please sign in to comment.