Skip to content

Commit a871ea4

Browse files
committed
ROSAENG-59425 add worder disk size support
Signed-off-by: lfalconm <lfalconm@redhat.com>
1 parent 0860fe7 commit a871ea4

5 files changed

Lines changed: 60 additions & 0 deletions

File tree

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ module "rosa_cluster_hcp" {
121121
replicas = var.replicas
122122
compute_machine_type = var.compute_machine_type
123123
aws_availability_zones = var.aws_availability_zones
124+
worker_disk_size = var.worker_disk_size
124125
aws_additional_compute_security_group_ids = var.aws_additional_compute_security_group_ids
125126

126127
########

modules/rosa-cluster-hcp/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ resource "rhcs_cluster_rosa_hcp" "rosa_hcp_cluster" {
7373
replicas = var.replicas
7474
aws_subnet_ids = var.aws_subnet_ids
7575
compute_machine_type = var.compute_machine_type
76+
worker_disk_size = var.worker_disk_size
7677
create_admin_user = local.create_admin_user
7778
admin_credentials = local.admin_credentials
7879
ec2_metadata_http_tokens = var.ec2_metadata_http_tokens

modules/rosa-cluster-hcp/tests/rosa_cluster_hcp.tftest.hcl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,41 @@ run "invalid_channel_three_part_version" {
225225
var.channel,
226226
]
227227
}
228+
229+
# worker_disk_size passthrough: null value (platform default).
230+
run "worker_disk_size_null" {
231+
command = plan
232+
233+
providers = {
234+
aws = aws.default
235+
rhcs = rhcs.import_sim
236+
}
237+
238+
variables {
239+
worker_disk_size = null
240+
}
241+
242+
assert {
243+
condition = rhcs_cluster_rosa_hcp.rosa_hcp_cluster.worker_disk_size == null
244+
error_message = "worker_disk_size must be null when set to null (platform default)."
245+
}
246+
}
247+
248+
# worker_disk_size passthrough: explicit value (400 GiB).
249+
run "worker_disk_size_explicit" {
250+
command = plan
251+
252+
providers = {
253+
aws = aws.default
254+
rhcs = rhcs.import_sim
255+
}
256+
257+
variables {
258+
worker_disk_size = 400
259+
}
260+
261+
assert {
262+
condition = rhcs_cluster_rosa_hcp.rosa_hcp_cluster.worker_disk_size == 400
263+
error_message = "worker_disk_size must be 400 when explicitly set to 400."
264+
}
265+
}

modules/rosa-cluster-hcp/variables.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,20 @@ variable "aws_availability_zones" {
313313
description = "The AWS availability zones where instances of the default worker machine pool are deployed. Leave empty for the installer to pick availability zones"
314314
}
315315

316+
variable "worker_disk_size" {
317+
type = number
318+
default = null
319+
description = "Worker node root disk size in GiB."
320+
321+
validation {
322+
condition = var.worker_disk_size == null ? true : (
323+
var.worker_disk_size > 0 &&
324+
floor(var.worker_disk_size) == var.worker_disk_size
325+
)
326+
error_message = "worker_disk_size must be a positive whole number (GiB)."
327+
}
328+
}
329+
316330
variable "aws_additional_compute_security_group_ids" {
317331
type = list(string)
318332
default = null

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,12 @@ variable "aws_availability_zones" {
247247
description = "The AWS availability zones where instances of the default worker machine pool are deployed. Leave empty for the installer to pick availability zones"
248248
}
249249

250+
variable "worker_disk_size" {
251+
type = number
252+
default = null
253+
description = "Default worker machine pool root disk size in GiB (e.g., 300, 400, 500). Leave null to use platform default."
254+
}
255+
250256
variable "aws_additional_compute_security_group_ids" {
251257
type = list(string)
252258
default = null

0 commit comments

Comments
 (0)