Skip to content

Commit 21fe817

Browse files
committed
handle storage size also
1 parent 3fa87cf commit 21fe817

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

modules/postgres/rds/0.2/facets.yaml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ spec:
9393
x-ui-placeholder: "Select writer instance type"
9494
required:
9595
- instance
96+
- allocated_storage
9697
reader:
9798
type: object
9899
title: Reader
@@ -150,14 +151,20 @@ spec:
150151
minimum: 0
151152
required:
152153
- instance
153-
storage_type:
154-
type: string
155-
title: Storage Type
156-
description: EBS volume type for database storage
157-
default: "gp3"
158-
enum:
159-
- "gp2"
160-
- "gp3"
154+
allocated_storage:
155+
type: integer
156+
title: Allocated Storage
157+
description: The allocated storage in gibibytes (GiB)
158+
minimum: 20
159+
maximum: 65536
160+
storage_type:
161+
type: string
162+
title: Storage Type
163+
description: EBS volume type for database storage
164+
default: "gp3"
165+
enum:
166+
- "gp2"
167+
- "gp3"
161168
db_names:
162169
type: array
163170
title: Database Names
@@ -233,7 +240,6 @@ spec:
233240
x-ui-order:
234241
- postgres_version
235242
- size
236-
- storage_type
237243
- db_names
238244
- db_schemas
239245
- use_snapshot

modules/postgres/rds/0.2/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ locals {
2323
user_defined_tags = lookup(local.metadata, "tags", {})
2424
tags = merge(local.user_defined_tags, var.environment.cloud_tags)
2525
iops = local.storage_type == "gp2" ? null : local.storage_type == "gp3" && local.allocated_storage < 400 ? null : lookup(local.advanced_rds_postgres, "iops", 12000) < 12000 ? 12000 : lookup(local.advanced_rds_postgres, "iops", 12000)
26-
allocated_storage = lookup(local.advanced_rds_postgres, "allocated_storage", 50)
27-
storage_type = lookup(var.instance.spec, "storage_type", lookup(local.advanced_rds_postgres, "storage_type", "gp3"))
26+
allocated_storage = lookup(local.instance_size, "allocated_storage", lookup(local.advanced_rds_postgres, "allocated_storage", 50))
27+
storage_type = lookup(local.instance_size, "storage_type", lookup(local.advanced_rds_postgres, "storage_type", "gp3"))
2828
max_allocated_storage = lookup(local.advanced_rds_postgres, "max_allocated_storage", 200)
2929
multi_az = lookup(local.advanced_rds_postgres, "multi_az", false)
3030
availability_zone = local.multi_az ? null : lookup(local.advanced_rds_postgres, "availability_zone", null) == null ? var.inputs.network_details.attributes.legacy_outputs.vpc_details.azs[0] : lookup(local.advanced_rds_postgres, "availability_zone", null)

0 commit comments

Comments
 (0)