diff --git a/edbterraform/data/terraform/aws/modules/specification/outputs.tf b/edbterraform/data/terraform/aws/modules/specification/outputs.tf index 8dcea652..d65eb347 100644 --- a/edbterraform/data/terraform/aws/modules/specification/outputs.tf +++ b/edbterraform/data/terraform/aws/modules/specification/outputs.tf @@ -46,6 +46,13 @@ locals { # assign zone from mapped names zone = var.spec.regions[machine_spec.region].zones[machine_spec.zone_name].zone cidr = var.spec.regions[machine_spec.region].zones[machine_spec.zone_name].cidr + + # expand any additional volumes with count > 1 and then merge the lists as a single list + additional_volumes = length(machine_spec.additional_volumes) > 0 ? flatten([ + for volume in machine_spec.additional_volumes: [ + for index in range(volume.count): volume + ] + ]) : machine_spec.additional_volumes }) } ] diff --git a/edbterraform/data/terraform/aws/modules/specification/variables.tf b/edbterraform/data/terraform/aws/modules/specification/variables.tf index 00bc749c..c59f99b7 100644 --- a/edbterraform/data/terraform/aws/modules/specification/variables.tf +++ b/edbterraform/data/terraform/aws/modules/specification/variables.tf @@ -98,6 +98,7 @@ variable "spec" { # Use jbod_volumes which are meant to represent "Just a bunch of Disks(Volumes)" as an alternative # to manually manage per machine instance post-terraform additional_volumes = optional(list(object({ + count = optional(number, 1) mount_point = optional(string) size_gb = number iops = optional(number) diff --git a/infrastructure-examples/aws/machines-v2.yml b/infrastructure-examples/aws/machines-v2.yml index 2474f8ff..85855a4a 100644 --- a/infrastructure-examples/aws/machines-v2.yml +++ b/infrastructure-examples/aws/machines-v2.yml @@ -19,7 +19,7 @@ aws: zone: us-west-2b cidr: 10.2.20.0/24 main: - zone: us-west-2b + zone: us-west-2a cidr: 10.2.30.0/24 service_ports: - port: 22 @@ -48,6 +48,7 @@ aws: tags: type: dbt2-driver pg1: + count: 2 image_name: rocky region: us-west-2 zone_name: main @@ -72,7 +73,8 @@ aws: size_gb: 100 encrypted: false additional_volumes: - - size_gb: 20 + - count: 4 + size_gb: 20 type: gp3 iops: 4000 throughput: 1000 @@ -89,12 +91,6 @@ aws: iops: 5000 encrypted: false filesystem: xfs - - size_gb: 20 - type: gp3 - iops: 4000 - throughput: 1000 - encrypted: false - volume_group: data volume_groups: data: /opt/data0: