Skip to content

Commit

Permalink
Add option for RDS parameter group name
Browse files Browse the repository at this point in the history
  • Loading branch information
nightfury1204 committed Jan 22, 2024
1 parent fa02053 commit 6c58f13
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
18 changes: 12 additions & 6 deletions provider/aws/formation/resource/mariadb.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Conditions": {
"BlankEncrypted": { "Fn::Equals": [ { "Ref": "Encrypted" }, "" ] },
"BlankIops": { "Fn::Equals": [ { "Ref": "Iops" }, "0" ] },
"BlankParameterGroupName": { "Fn::Equals": [ { "Ref": "ParameterGroupName" }, "" ] },
"BlankPreferredBackupWindow": { "Fn::Equals": [ { "Ref": "PreferredBackupWindow" }, "" ] }
},
"Parameters": {
Expand Down Expand Up @@ -43,6 +44,10 @@
"NoEcho": true,
"Type": "String"
},
"ParameterGroupName": {
"Type" : "String",
"Default": ""
},
"PreferredBackupWindow": {
"Type": "String",
"Default": ""
Expand Down Expand Up @@ -100,12 +105,13 @@
"DBInstanceClass": { "Ref": "Class" },
"DBInstanceIdentifier": { "Ref": "AWS::StackName" },
"DBName": "app",
"DBParameterGroupName": { "Fn::Sub": [ "default.mariadb${Base}", {
"Base": { "Fn::Join": [ ".", [
{ "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] },
{ "Fn::Select": [ 1, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] }
] ] }
} ] },
"DBParameterGroupName": { "Fn::If": [ "BlankParameterGroupName", { "Fn::Sub": [ "default.mariadb${Base}", {
"Base": { "Fn::Join": [ ".", [
{ "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] },
{ "Fn::Select": [ 1, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] }
] ] }
} ] },
{ "Ref": "ParameterGroupName" } ] },
"DBSubnetGroupName": { "Ref": "SubnetGroup" },
"DeletionProtection": { "Ref": "DeletionProtection" },
"Engine": "mariadb",
Expand Down
18 changes: 12 additions & 6 deletions provider/aws/formation/resource/mysql.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Conditions": {
"BlankEncrypted": { "Fn::Equals": [ { "Ref": "Encrypted" }, "" ] },
"BlankIops": { "Fn::Equals": [ { "Ref": "Iops" }, "0" ] },
"BlankParameterGroupName": { "Fn::Equals": [ { "Ref": "ParameterGroupName" }, "" ] },
"BlankPreferredBackupWindow": { "Fn::Equals": [ { "Ref": "PreferredBackupWindow" }, "" ] }
},
"Parameters": {
Expand Down Expand Up @@ -43,6 +44,10 @@
"NoEcho": true,
"Type": "String"
},
"ParameterGroupName": {
"Type" : "String",
"Default": ""
},
"PreferredBackupWindow": {
"Type": "String",
"Default": ""
Expand Down Expand Up @@ -100,12 +105,13 @@
"DBInstanceClass": { "Ref": "Class" },
"DBInstanceIdentifier": { "Ref": "AWS::StackName" },
"DBName": "app",
"DBParameterGroupName": { "Fn::Sub": [ "default.mysql${Base}", {
"Base": { "Fn::Join": [ ".", [
{ "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] },
{ "Fn::Select": [ 1, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] }
] ] }
} ] },
"DBParameterGroupName": { "Fn::If": [ "BlankParameterGroupName", { "Fn::Sub": [ "default.mysql${Base}", {
"Base": { "Fn::Join": [ ".", [
{ "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] },
{ "Fn::Select": [ 1, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] }
] ] }
} ] },
{ "Ref": "ParameterGroupName" } ] },
"DBSubnetGroupName": { "Ref": "SubnetGroup" },
"DeletionProtection": { "Ref": "DeletionProtection" },
"Engine": "mysql",
Expand Down
23 changes: 14 additions & 9 deletions provider/aws/formation/resource/postgres.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"BlankEncrypted": { "Fn::Equals": [ { "Ref": "Encrypted" }, "" ] },
"BlankIops": { "Fn::Equals": [ { "Ref": "Iops" }, "0" ] },
"BlankPreferredBackupWindow": { "Fn::Equals": [ { "Ref": "PreferredBackupWindow" }, "" ] },
"BlankParameterGroupName": { "Fn::Equals": [ { "Ref": "ParameterGroupName" }, "" ] },
"Version9": { "Fn::Equals": [ { "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] }, "9" ] }
},
"Parameters": {
Expand Down Expand Up @@ -44,6 +45,10 @@
"NoEcho": true,
"Type": "String"
},
"ParameterGroupName": {
"Type" : "String",
"Default": ""
},
"PreferredBackupWindow": {
"Type": "String",
"Default": ""
Expand Down Expand Up @@ -101,15 +106,15 @@
"DBInstanceClass": { "Ref": "Class" },
"DBInstanceIdentifier": { "Ref": "AWS::StackName" },
"DBName": "app",
"DBParameterGroupName": { "Fn::Sub": [ "default.postgres${Base}", {
"Base": { "Fn::If": [ "Version9",
{ "Fn::Join": [ ".", [
{ "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] },
{ "Fn::Select": [ 1, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] }
] ] },
{ "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] }
] }
} ] },
"DBParameterGroupName": { "Fn::If": [ "BlankParameterGroupName", { "Fn::If": [ "Version9",
{ "Fn::Join": [ ".", [
{ "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] },
{ "Fn::Select": [ 1, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] }
] ] },
{ "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Ref": "Version" } ] } ] }
] }
} ] },
{ "Ref": "ParameterGroupName" } ] },
"DBSubnetGroupName": { "Ref": "SubnetGroup" },
"DeletionProtection": { "Ref": "DeletionProtection" },
"Engine": "postgres",
Expand Down

0 comments on commit 6c58f13

Please sign in to comment.