From 6b6433a9752a5b16d358a122bf205fb04e0ab423 Mon Sep 17 00:00:00 2001 From: James Maradiaga Date: Mon, 24 Jun 2024 18:20:43 -0600 Subject: [PATCH 1/3] feat: added DBParameterGroupName to rds --- README.md | 8 ++++++++ module.yml | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 509ab1a..3a4a745 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Resources: DBMasterUserPassword: '' # required if neither DBSnapshotIdentifier nor SecretModule is set DBMultiAZ: 'true' # optional SubDomainNameWithDot: 'postgres.' # optional + ParameterGroupName: '' #optional # Set this to the version of PostgreSQL you want to use. # You can run the following command to get the list of PostgreSQL versions supported by AWS RDS: # aws rds describe-db-engine-versions --engine postgres --query "DBEngineVersions[].EngineVersion" @@ -180,6 +181,13 @@ Resources: no + + ParameterGroupName + parameter group that contains configuration settings for the database engine you're using + + no + + EngineVersion The PostgreSQL version. diff --git a/module.yml b/module.yml index 0d4878d..7c68e8c 100644 --- a/module.yml +++ b/module.yml @@ -92,6 +92,10 @@ Parameters: Type: String AllowedValues: ['true', 'false'] Default: 'false' + ParameterGroupName: + Description: 'Optional name of parameter group to attach to.' + Type: String + Default: '' Resources: Instance: Type: 'AWS::CloudFormation::Stack' @@ -114,6 +118,7 @@ Resources: DBBackupRetentionPeriod: !Ref DBBackupRetentionPeriod DBMasterUsername: !Ref DBMasterUsername DBMasterUserPassword: !Ref DBMasterUserPassword + DBParameterGroupName: !Ref ParameterGroupName DBMultiAZ: !Ref DBMultiAZ SubDomainNameWithDot: !Ref SubDomainNameWithDot EnableIAMDatabaseAuthentication: !Ref EnableIAMDatabaseAuthentication From dae6bf86c14dc464cef7013f1ed5560c755ff1fb Mon Sep 17 00:00:00 2001 From: James Maradiaga Date: Thu, 27 Jun 2024 15:08:05 -0600 Subject: [PATCH 2/3] feat: added DBParameterGroupName test --- test/dbparameter.js | 18 ++++++++++++++++++ test/dbparameter.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 test/dbparameter.js create mode 100644 test/dbparameter.yml diff --git a/test/dbparameter.js b/test/dbparameter.js new file mode 100644 index 0000000..7e594c4 --- /dev/null +++ b/test/dbparameter.js @@ -0,0 +1,18 @@ +const test = require('ava'); +const cfntest = require('@cfn-modules/test'); + +test.serial('dbparameter', async t => { + const stackName = cfntest.stackName(); + try { + t.log(await cfntest.createStack(`${__dirname}/dbparameter.yml`, stackName, {})); + // what could we test here? + } finally { + t.log(await cfntest.deleteStack(stackName)); + t.pass(); + } +}); + +// TODO test with-alerting +// TODO test with-hosted-zone-private +// TODO test with-bastion (SQL access) +// TODO test with-kms diff --git a/test/dbparameter.yml b/test/dbparameter.yml new file mode 100644 index 0000000..57d0585 --- /dev/null +++ b/test/dbparameter.yml @@ -0,0 +1,29 @@ +--- +AWSTemplateFormatVersion: '2010-09-09' +Description: 'cfn-modules test' +Resources: + Vpc: + Type: 'AWS::CloudFormation::Stack' + Properties: + Parameters: + S3Endpoint: 'false' # speed up the test + DynamoDBEndpoint: 'false' # speed up the test + FlowLog: 'false' # speed up the test + NatGateways: 'false' # speed up the test + TemplateURL: './node_modules/@cfn-modules/vpc/module.yml' + ClientSg: + Type: 'AWS::CloudFormation::Stack' + Properties: + Parameters: + VpcModule: !GetAtt 'Vpc.Outputs.StackName' + TemplateURL: './node_modules/@cfn-modules/client-sg/module.yml' + Database: + Type: 'AWS::CloudFormation::Stack' + Properties: + Parameters: + VpcModule: !GetAtt 'Vpc.Outputs.StackName' + ClientSgModule: !GetAtt 'ClientSg.Outputs.StackName' + DBMasterUserPassword: 'test1234' + ParameterGroupName: 'default.postgres14' # using default parameter + EngineVersion: '14.5' + TemplateURL: './node_modules/@cfn-modules/rds-postgres/module.yml' From add941ff2c79a190eb296a7f7b7ae5aad075c670 Mon Sep 17 00:00:00 2001 From: James Maradiaga <87324382+Ancordss@users.noreply.github.com> Date: Mon, 5 Aug 2024 09:13:56 -0600 Subject: [PATCH 3/3] Update dbparameter.yml --- test/dbparameter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dbparameter.yml b/test/dbparameter.yml index 57d0585..cba1266 100644 --- a/test/dbparameter.yml +++ b/test/dbparameter.yml @@ -25,5 +25,5 @@ Resources: ClientSgModule: !GetAtt 'ClientSg.Outputs.StackName' DBMasterUserPassword: 'test1234' ParameterGroupName: 'default.postgres14' # using default parameter - EngineVersion: '14.5' + EngineVersion: '14.12' TemplateURL: './node_modules/@cfn-modules/rds-postgres/module.yml'