Skip to content

Commit

Permalink
Change Terraform GCP module API aboput machinetype
Browse files Browse the repository at this point in the history
Change variable name in all module from machine_type to vm_size.
Adapt accordingly the module main and the top level main.
Add configurability for Monitor, the only one was missing a variable for
the machine type.
Remove all the default values for vm_size, at module level.
This commit does not result in any API or functional change for the end
user.
  • Loading branch information
mpagot committed Sep 4, 2024
1 parent d04d282 commit aaa204b
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 20 deletions.
8 changes: 4 additions & 4 deletions terraform/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ module "drbd_node" {
name = var.drbd_name
network_domain = var.drbd_network_domain == "" ? var.network_domain : var.drbd_network_domain
drbd_count = var.drbd_enabled == true ? 2 : 0
machine_type = var.drbd_machine_type
vm_size = var.drbd_machine_type
compute_zones = local.compute_zones
network_name = local.vpc_name
network_subnet_name = local.subnet_name
Expand All @@ -164,7 +164,7 @@ module "netweaver_node" {
network_domain = var.netweaver_network_domain == "" ? var.network_domain : var.netweaver_network_domain
xscs_server_count = local.netweaver_xscs_server_count
app_server_count = var.netweaver_enabled ? var.netweaver_app_server_count : 0
machine_type = var.netweaver_machine_type
vm_size = var.netweaver_machine_type
compute_zones = local.compute_zones
network_name = local.vpc_name
network_subnet_name = local.subnet_name
Expand All @@ -182,7 +182,7 @@ module "hana_node" {
name = var.hana_name
network_domain = var.hana_network_domain == "" ? var.network_domain : var.hana_network_domain
hana_count = var.hana_count
machine_type = var.machine_type
vm_size = var.machine_type
compute_zones = local.compute_zones
network_name = local.vpc_name
network_subnet_name = local.subnet_name
Expand Down Expand Up @@ -216,7 +216,7 @@ module "iscsi_server" {
name = var.iscsi_name
network_domain = var.iscsi_network_domain == "" ? var.network_domain : var.iscsi_network_domain
iscsi_count = local.iscsi_enabled == true ? var.iscsi_count : 0
machine_type = var.machine_type_iscsi_server
vm_size = var.machine_type_iscsi_server
compute_zones = local.compute_zones
network_subnet_name = local.subnet_name
os_image = local.iscsi_os_image
Expand Down
2 changes: 1 addition & 1 deletion terraform/gcp/modules/drbd_node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module "drbd-load-balancer" {
}

resource "google_compute_instance" "drbd" {
machine_type = var.machine_type
machine_type = var.vm_size
name = "${var.common_variables["deployment_name"]}-${var.name}${format("%02d", count.index + 1)}"
count = var.drbd_count
zone = element(var.compute_zones, count.index)
Expand Down
6 changes: 3 additions & 3 deletions terraform/gcp/modules/drbd_node/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ variable "drbd_count" {
default = 2
}

variable "machine_type" {
type = string
default = "n1-standard-4"
variable "vm_size" {
description = "The instance type of DRDB node"
type = string
}

variable "os_image" {
Expand Down
2 changes: 1 addition & 1 deletion terraform/gcp/modules/hana_node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module "hana-secondary-load-balancer" {
}

resource "google_compute_instance" "clusternodes" {
machine_type = var.machine_type
machine_type = var.vm_size
name = "${var.common_variables["deployment_name"]}-${var.name}${format("%02d", count.index + 1)}"
count = var.hana_count
zone = element(var.compute_zones, count.index)
Expand Down
3 changes: 1 addition & 2 deletions terraform/gcp/modules/hana_node/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ variable "hana_count" {
default = 2
}

variable "machine_type" {
variable "vm_size" {
description = "The instance type of HANA node"
type = string
default = "n1-highmem-32"
}

variable "os_image" {
Expand Down
2 changes: 1 addition & 1 deletion terraform/gcp/modules/iscsi_server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ resource "google_compute_instance" "iscsisrv" {
count = var.iscsi_count
name = "${var.common_variables["deployment_name"]}-${var.name}${format("%02d", count.index + 1)}"
description = "iSCSI server"
machine_type = var.machine_type
machine_type = var.vm_size
zone = element(var.compute_zones, 0)

can_ip_forward = true
Expand Down
6 changes: 3 additions & 3 deletions terraform/gcp/modules/iscsi_server/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ variable "iscsi_count" {
type = number
}

variable "machine_type" {
type = string
default = "custom-1-2048"
variable "vm_size" {
description = "The instance type of ISCSI node"
type = string
}

variable "os_image" {
Expand Down
2 changes: 1 addition & 1 deletion terraform/gcp/modules/monitoring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "google_compute_instance" "monitoring" {
count = var.monitoring_enabled == true ? 1 : 0
name = "${var.common_variables["deployment_name"]}-${var.name}"
description = "Monitoring server"
machine_type = "custom-1-2048"
machine_type = var.vm_size
zone = element(var.compute_zones, 0)

can_ip_forward = true
Expand Down
5 changes: 5 additions & 0 deletions terraform/gcp/modules/monitoring/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ variable "name" {
type = string
}

variable "vm_size" {
description = "The instance type of MONITOR node"
type = string
}

variable "monitoring_enabled" {
description = "enable the host to be monitored by exporters, e.g node_exporter"
type = bool
Expand Down
2 changes: 1 addition & 1 deletion terraform/gcp/modules/netweaver_node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module "netweaver-load-balancer-ers" {
}

resource "google_compute_instance" "netweaver" {
machine_type = var.machine_type
machine_type = var.vm_size
name = "${var.common_variables["deployment_name"]}-${var.name}${format("%02d", count.index + 1)}"
count = local.vm_count
zone = element(var.compute_zones, count.index)
Expand Down
5 changes: 2 additions & 3 deletions terraform/gcp/modules/netweaver_node/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ variable "app_server_count" {
default = 2
}

variable "machine_type" {
type = string
default = "n1-standard-4"
variable "vm_size" {
type = string
}

variable "os_image" {
Expand Down

0 comments on commit aaa204b

Please sign in to comment.