From 3039d40712a0f4cec58ce423899126e68c55e1eb Mon Sep 17 00:00:00 2001 From: lfalconm Date: Wed, 10 Jun 2026 12:45:00 -0400 Subject: [PATCH] ROSAENG-59425 | feat: add worder disk size support Signed-off-by: lfalconm --- README.md | 1 + main.tf | 1 + modules/rosa-cluster-hcp/README.md | 1 + modules/rosa-cluster-hcp/main.tf | 1 + .../tests/rosa_cluster_hcp.tftest.hcl | 38 +++++++++++++++++++ modules/rosa-cluster-hcp/variables.tf | 14 +++++++ variables.tf | 6 +++ 7 files changed, 62 insertions(+) diff --git a/README.md b/README.md index 77c43cf..137b8e8 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ We recommend you install the following CLI tools: | [version\_channel\_group](#input\_version\_channel\_group) | Desired channel group of the version [stable, candidate, fast, nightly]. Cannot be used together with 'channel'. Starting from RHCS Terraform provider version 1.7.7, this attribute no longer has a default value and is computed by the API. | `string` | `null` | no | | [wait\_for\_create\_complete](#input\_wait\_for\_create\_complete) | Wait until the cluster is either in a ready state or in an error state. The waiter has a timeout of 20 minutes. (default: true) | `bool` | `true` | no | | [wait\_for\_std\_compute\_nodes\_complete](#input\_wait\_for\_std\_compute\_nodes\_complete) | Wait until the initial set of machine pools to be available. The waiter has a timeout of 60 minutes. (default: true) | `bool` | `true` | no | +| [worker\_disk\_size](#input\_worker\_disk\_size) | Default worker machine pool root disk size in GiB (e.g., 300, 400, 500). Leave null to use platform default. | `number` | `null` | no | ## Outputs diff --git a/main.tf b/main.tf index f6ae408..89bfb4e 100644 --- a/main.tf +++ b/main.tf @@ -121,6 +121,7 @@ module "rosa_cluster_hcp" { replicas = var.replicas compute_machine_type = var.compute_machine_type aws_availability_zones = var.aws_availability_zones + worker_disk_size = var.worker_disk_size aws_additional_compute_security_group_ids = var.aws_additional_compute_security_group_ids ######## diff --git a/modules/rosa-cluster-hcp/README.md b/modules/rosa-cluster-hcp/README.md index e6e703c..bc88ec6 100644 --- a/modules/rosa-cluster-hcp/README.md +++ b/modules/rosa-cluster-hcp/README.md @@ -124,6 +124,7 @@ No modules. | [version\_channel\_group](#input\_version\_channel\_group) | Desired channel group of the version [stable, candidate, fast, nightly]. Cannot be used together with 'channel'. Starting from RHCS Terraform provider version 1.7.7, this attribute no longer has a default value and is computed by the API. | `string` | `null` | no | | [wait\_for\_create\_complete](#input\_wait\_for\_create\_complete) | Wait until the cluster is either in a ready state or in an error state. The waiter has a timeout of 20 minutes. (default: true) | `bool` | `true` | no | | [wait\_for\_std\_compute\_nodes\_complete](#input\_wait\_for\_std\_compute\_nodes\_complete) | Wait until the cluster standard compute nodes are available. The waiter has a timeout of 60 minutes. (default: true) | `bool` | `true` | no | +| [worker\_disk\_size](#input\_worker\_disk\_size) | Worker node root disk size in GiB. | `number` | `null` | no | | [worker\_role\_arn](#input\_worker\_role\_arn) | The Amazon Resource Name (ARN) associated with the AWS IAM role that will be used by the cluster's compute instances. | `string` | `null` | no | ## Outputs diff --git a/modules/rosa-cluster-hcp/main.tf b/modules/rosa-cluster-hcp/main.tf index b6758be..5058774 100644 --- a/modules/rosa-cluster-hcp/main.tf +++ b/modules/rosa-cluster-hcp/main.tf @@ -73,6 +73,7 @@ resource "rhcs_cluster_rosa_hcp" "rosa_hcp_cluster" { replicas = var.replicas aws_subnet_ids = var.aws_subnet_ids compute_machine_type = var.compute_machine_type + worker_disk_size = var.worker_disk_size create_admin_user = local.create_admin_user admin_credentials = local.admin_credentials ec2_metadata_http_tokens = var.ec2_metadata_http_tokens diff --git a/modules/rosa-cluster-hcp/tests/rosa_cluster_hcp.tftest.hcl b/modules/rosa-cluster-hcp/tests/rosa_cluster_hcp.tftest.hcl index d71d4e1..a82fde4 100644 --- a/modules/rosa-cluster-hcp/tests/rosa_cluster_hcp.tftest.hcl +++ b/modules/rosa-cluster-hcp/tests/rosa_cluster_hcp.tftest.hcl @@ -225,3 +225,41 @@ run "invalid_channel_three_part_version" { var.channel, ] } + +# worker_disk_size passthrough: null value (platform default). +run "worker_disk_size_null" { + command = plan + + providers = { + aws = aws.default + rhcs = rhcs.import_sim + } + + variables { + worker_disk_size = null + } + + assert { + condition = rhcs_cluster_rosa_hcp.rosa_hcp_cluster.worker_disk_size == null + error_message = "worker_disk_size must be null when set to null (platform default)." + } +} + +# worker_disk_size passthrough: explicit value (400 GiB). +run "worker_disk_size_explicit" { + command = plan + + providers = { + aws = aws.default + rhcs = rhcs.import_sim + } + + variables { + worker_disk_size = 400 + } + + assert { + condition = rhcs_cluster_rosa_hcp.rosa_hcp_cluster.worker_disk_size == 400 + error_message = "worker_disk_size must be 400 when explicitly set to 400." + } +} diff --git a/modules/rosa-cluster-hcp/variables.tf b/modules/rosa-cluster-hcp/variables.tf index 4851ae5..c8c5fc5 100644 --- a/modules/rosa-cluster-hcp/variables.tf +++ b/modules/rosa-cluster-hcp/variables.tf @@ -313,6 +313,20 @@ variable "aws_availability_zones" { description = "The AWS availability zones where instances of the default worker machine pool are deployed. Leave empty for the installer to pick availability zones" } +variable "worker_disk_size" { + type = number + default = null + description = "Worker node root disk size in GiB." + + validation { + condition = var.worker_disk_size == null ? true : ( + var.worker_disk_size > 0 && + floor(var.worker_disk_size) == var.worker_disk_size + ) + error_message = "worker_disk_size must be a positive whole number (GiB)." + } +} + variable "aws_additional_compute_security_group_ids" { type = list(string) default = null diff --git a/variables.tf b/variables.tf index 9a314f2..7eba16c 100644 --- a/variables.tf +++ b/variables.tf @@ -247,6 +247,12 @@ variable "aws_availability_zones" { description = "The AWS availability zones where instances of the default worker machine pool are deployed. Leave empty for the installer to pick availability zones" } +variable "worker_disk_size" { + type = number + default = null + description = "Default worker machine pool root disk size in GiB (e.g., 300, 400, 500). Leave null to use platform default." +} + variable "aws_additional_compute_security_group_ids" { type = list(string) default = null