Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(db): add storage type configuration support #790

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions aws/components/db/id.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,36 @@
AWS_AUTOSCALING_SERVICE
]
/]


[@addResourceGroupAttributeValues
type=DB_COMPONENT_TYPE
provider=AWS_PROVIDER
extensions=[
{
"Names" : "Storage",
"Description" : "Additional storage configuration options",
"Children" : [
{
"Names": "Type",
"Description": "The type of storage to use for the database",
"Types": STRING_TYPE,
"Values" : ["gp2", "gp3", "io1", "standard"],
"Default": "gp2"
},
{
"Names": "Throughput",
"Description": "Specifiy the throughput you want for gp-3 volumes",
"Types" : NUMBER_TYPE,
"Default" : -1
},
{
"Names" : "Iops",
"Description" : "Specify the IOPS you want for types that support it",
"Types" : NUMBER_TYPE,
"Default": -1
}
]
}
]
/]
3 changes: 3 additions & 0 deletions aws/components/db/setup.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,9 @@
copyTagsToSnapshot=true
deletionProtection=deletionProtection
cloudWatchLogExports=cloudWatchLogExports
storageType=solution["aws:Storage"].Type
storageIops=solution["aws:Storage"].Iops
storageThroughput=solution["aws:Storage"].Throughput
maintenanceWindow=
solution.MaintenanceWindow.Configured?then(
getAmazonRdsMaintenanceWindow(
Expand Down
23 changes: 19 additions & 4 deletions aws/services/rds/resource.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
databaseName=""
port=""
retentionPeriod=""
storageType=""
storageIops=0
storageThroughput=0
size=""
snapshotArn=""
dependencies=""
Expand Down Expand Up @@ -183,15 +186,27 @@
size,
size?c?string
),
"StorageType" : "gp2",
"StorageType" : storageType,
"BackupRetentionPeriod" : retentionPeriod,
"DBInstanceIdentifier": name,
"VPCSecurityGroups": asArray( getReference(securityGroupId)),
"Port" : port?c?string,
"EngineVersion": engineVersion,
"CopyTagsToSnapshot": copyTagsToSnapshot,
"DeletionProtection": deletionProtection
},
} +
valueIfTrue(
{
"Iops": storageIops
},
(["gp3", "io1"]?seq_contains(storageType) && storageIops > 0 )
) +
valueIfTrue(
{
"StorageThroughput": storageThroughput
},
( storageType == "gp3" && storageThroughput > 0 )
),
( !clusterMember ),
{
"DBClusterIdentifier" : getReference(clusterId),
Expand All @@ -202,7 +217,7 @@
attributeIfContent(
"EnableCloudwatchLogsExports",
cloudWatchLogExports
) +
) +
valueIfTrue(
{
"MultiAZ": true
Expand Down Expand Up @@ -317,7 +332,7 @@
attributeIfContent(
"EnableCloudwatchLogsExports",
cloudWatchLogExports
) +
) +
attributeIfContent(
"PreferredMaintenanceWindow",
maintenanceWindow
Expand Down