diff --git a/README.md b/README.md index 635ff8a..c3f758c 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 e8e7f82..0d547d1 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 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..cba1266 --- /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.12' + TemplateURL: './node_modules/@cfn-modules/rds-postgres/module.yml'