Skip to content

Commit

Permalink
Make osdisk size configurable
Browse files Browse the repository at this point in the history
Default osdisk sizes:
- jenkins-controller: 150 GB
- builder: 150 GB
- binary-cache: 50 GB

Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
  • Loading branch information
tervis-unikie committed Feb 27, 2024
1 parent e2c0783 commit a3d470c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions terraform/binary-cache.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII)
#
# SPDX-FileCopyrightText: 2022-2024 Technology Innovation Institute (TII)
# SPDX-License-Identifier: Apache-2.0

module "binary_cache_image" {
Expand All @@ -22,6 +21,7 @@ module "binary_cache_vm" {
location = azurerm_resource_group.infra.location
virtual_machine_name = "ghaf-binary-cache-${local.env}"
virtual_machine_size = local.opts[local.conf].vm_size_binarycache
virtual_machine_osdisk_size = "50"
virtual_machine_source_image = module.binary_cache_image.image_id

virtual_machine_custom_data = join("\n", ["#cloud-config", yamlencode({
Expand Down
4 changes: 2 additions & 2 deletions terraform/builder.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII)
#
# SPDX-FileCopyrightText: 2022-2024 Technology Innovation Institute (TII)
# SPDX-License-Identifier: Apache-2.0

module "builder_image" {
Expand Down Expand Up @@ -28,6 +27,7 @@ module "builder_vm" {
location = azurerm_resource_group.infra.location
virtual_machine_name = "ghaf-builder-${count.index}-${local.env}"
virtual_machine_size = local.opts[local.conf].vm_size_builder
virtual_machine_osdisk_size = "150"
virtual_machine_source_image = module.builder_image.image_id

virtual_machine_custom_data = join("\n", ["#cloud-config", yamlencode({
Expand Down
4 changes: 2 additions & 2 deletions terraform/jenkins-controller.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII)
#
# SPDX-FileCopyrightText: 2022-2024 Technology Innovation Institute (TII)
# SPDX-License-Identifier: Apache-2.0

# Build the Jenkins controller image
Expand All @@ -24,6 +23,7 @@ module "jenkins_controller_vm" {
location = azurerm_resource_group.infra.location
virtual_machine_name = "ghaf-jenkins-controller-${local.env}"
virtual_machine_size = local.opts[local.conf].vm_size_controller
virtual_machine_osdisk_size = "150"
virtual_machine_source_image = module.jenkins_controller_image.image_id

virtual_machine_custom_data = join("\n", ["#cloud-config", yamlencode({
Expand Down
7 changes: 5 additions & 2 deletions terraform/modules/azurerm-linux-vm/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII)
#
# SPDX-FileCopyrightText: 2022-2024 Technology Innovation Institute (TII)
# SPDX-License-Identifier: Apache-2.0

variable "resource_group_name" {
Expand All @@ -18,6 +17,10 @@ variable "virtual_machine_size" {
type = string
}

variable "virtual_machine_osdisk_size" {
type = string
}

variable "virtual_machine_source_image" {
type = string
}
Expand Down
5 changes: 2 additions & 3 deletions terraform/modules/azurerm-linux-vm/virtual_machine.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII)
#
# SPDX-FileCopyrightText: 2022-2024 Technology Innovation Institute (TII)
# SPDX-License-Identifier: Apache-2.0

resource "azurerm_virtual_machine" "main" {
Expand Down Expand Up @@ -56,7 +55,7 @@ resource "azurerm_virtual_machine" "main" {
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
disk_size_gb = "100"
disk_size_gb = var.virtual_machine_osdisk_size
}

dynamic "storage_data_disk" {
Expand Down

0 comments on commit a3d470c

Please sign in to comment.