---
AWSTemplateFormatVersion: '2010-09-09'
Description: PeopleSoft Environment Database
Parameters:
SecurityGroupCloudFormationName:
Description: CloudFormation Security Group Name
Type: String
Default: "PeopleSoftSG"
PillarLowerCase:
Description: Lower Case Environment Pillar Identifier (el, hr, or sa)
Type: String
Default: "el"
EnvironmentLowerCase:
Description: Loser Case Environment Identifier (dev, tst, stg, prd, etc.)
Type: String
Default: "dev"
PillarUpperCase:
Description: Upper Case Environment Pillar Identifier (EL, HR, or SA)
Type: String
Default: "EL"
EnvironmentUpperCase:
Description: Upper Case Environment Identifier (DEV, TST, STG, PRD, etc.)
Type: String
Default: "DEV"
DBSnapshotID:
Description: DB Snapshot from Which to Restore From
Type: String
Default: "peoplesoft-eldev-final-snapshot"
DBMultiAz:
Description: DB Multi Availibility Zone Deployment (boolean)
Type: String
Default: "false"
DBInstanceClass:
Description: DB Instance Class
Type: String
Default: "db.t2.medium"
DBStorageType:
Description: DB Storage Type (gp2-SSD, io1-Provisioned IOPS)
Type: String
Default: "gp2"
TagService:
Description: Refers to the application (Uaccess Learning, Uaccess Employee, Uaccess Student)
Type: String
Default: "Uaccess Learning"
TagContactNetid:
Description: NetID of person most familiar with resource
Type: String
Default: "kellehs"
TagAccountNumber:
Description: Identifies the financial system account number
Type: String
Default: "Human Resources Systems"
TagSubAccount:
Description: Identifies the financial system subaccount number
Type: String
Default: "Uaccess Learning"
TagTicketNumber:
Description: Jira Ticket Number
Type: String
Default: "CLOUD-15"
SetUpLikePrd:
Description: If set to Y then will set up like a Production Environment
Type: String
Default: "N"
PreferredAz:
Description: Preferred Availability Zone
Type: String
Default: "us-west-2a"
TakeSnapshot:
Description: Take a final RDS Snapshot on Delete for the instance (Y/N)
Type: String
Default: "Y"
DBEngineVersion:
Description: The DB Engine Version should be used
Type: String
Default: "12.1.0.2.v15"
Conditions:
ThisIsProd: !Equals [!Ref "SetUpLikePrd", "Y"]
ThisIsNotProd: !And [ !Not [ !Equals [!Ref "SetUpLikePrd", "Y"] ], !Equals [!Ref "TakeSnapshot", "Y"] ]
ThisIsNotProdNoSnap: !And [ !Not [ !Equals [!Ref "SetUpLikePrd", "Y"] ], !Equals [!Ref "TakeSnapshot", "N"] ]
Resources:
DBInstanceProd:
Type: AWS::RDS::DBInstance
Condition: ThisIsProd
Properties:
DBInstanceIdentifier: !Sub "peoplesoft-${PillarLowerCase}${EnvironmentLowerCase}"
DBName: !Sub "${PillarUpperCase}${EnvironmentUpperCase}"
DBSnapshotIdentifier: !Ref "DBSnapshotID"
MultiAZ: !Ref "DBMultiAz"
Engine: "oracle-ee"
LicenseModel: "bring-your-own-license"
DBInstanceClass: !Ref "DBInstanceClass"
DBParameterGroupName: "peoplesoft-oracle-ee-12-1"
OptionGroupName: "oem-agent-ee-12-1"
StorageType: !Ref "DBStorageType"
CopyTagsToSnapshot: "true"
BackupRetentionPeriod: 21
EngineVersion: !Ref "DBEngineVersion"
DBSubnetGroupName:
Fn::ImportValue:
!Sub "${SecurityGroupCloudFormationName}-RDSSubnetGroup"
VPCSecurityGroups:
- Fn::ImportValue:
!Sub "${SecurityGroupCloudFormationName}-DbSg"
Tags:
- Key: service
Value: !Ref "TagService"
- Key: Name
Value: !Sub "peoplesoft-${PillarLowerCase}${EnvironmentLowerCase}-rds"
- Key: environment
Value: !Ref "EnvironmentLowerCase"
- Key: contactnetid
Value: !Ref "TagContactNetid"
- Key: accountnumber
Value: !Ref "TagAccountNumber"
- Key: subaccount
Value: !Ref "TagSubAccount"
- Key: ticketnumber
Value: !Ref "TagTicketNumber"
DeletionPolicy: "Snapshot"
DBInstanceNonProd:
Type: AWS::RDS::DBInstance
Condition: ThisIsNotProd
Properties:
DBInstanceIdentifier: !Sub "peoplesoft-${PillarLowerCase}${EnvironmentLowerCase}"
DBName: !Sub "${PillarUpperCase}${EnvironmentUpperCase}"
DBSnapshotIdentifier: !Ref "DBSnapshotID"
AvailabilityZone: !Ref "PreferredAz"
Engine: "oracle-ee"
LicenseModel: "bring-your-own-license"
DBInstanceClass: !Ref "DBInstanceClass"
DBParameterGroupName: "peoplesoft-oracle-ee-12-1"
OptionGroupName: "oem-agent-ee-12-1"
StorageType: !Ref "DBStorageType"
CopyTagsToSnapshot: "true"
BackupRetentionPeriod: 7
EngineVersion: !Ref "DBEngineVersion"
DBSubnetGroupName:
Fn::ImportValue:
!Sub "${SecurityGroupCloudFormationName}-RDSSubnetGroup"
VPCSecurityGroups:
- Fn::ImportValue:
!Sub "${SecurityGroupCloudFormationName}-DbSg"
Tags:
- Key: service
Value: !Ref "TagService"
- Key: Name
Value: !Sub "peoplesoft-${PillarLowerCase}${EnvironmentLowerCase}-rds"
- Key: environment
Value: !Ref "EnvironmentLowerCase"
- Key: contactnetid
Value: !Ref "TagContactNetid"
- Key: accountnumber
Value: !Ref "TagAccountNumber"
- Key: subaccount
Value: !Ref "TagSubAccount"
- Key: ticketnumber
Value: !Ref "TagTicketNumber"
DeletionPolicy: "Snapshot"
DBInstanceNonProdNoSnap:
Type: AWS::RDS::DBInstance
Condition: ThisIsNotProdNoSnap
Properties:
DBInstanceIdentifier: !Sub "peoplesoft-${PillarLowerCase}${EnvironmentLowerCase}"
DBName: !Sub "${PillarUpperCase}${EnvironmentUpperCase}"
DBSnapshotIdentifier: !Ref "DBSnapshotID"
AvailabilityZone: !Ref "PreferredAz"
Engine: "oracle-ee"
LicenseModel: "bring-your-own-license"
DBInstanceClass: !Ref "DBInstanceClass"
DBParameterGroupName: "peoplesoft-oracle-ee-12-1"
OptionGroupName: "oem-agent-ee-12-1"
StorageType: !Ref "DBStorageType"
CopyTagsToSnapshot: "true"
BackupRetentionPeriod: 7
EngineVersion: !Ref "DBEngineVersion"
DBSubnetGroupName:
Fn::ImportValue:
!Sub "${SecurityGroupCloudFormationName}-RDSSubnetGroup"
VPCSecurityGroups:
- Fn::ImportValue:
!Sub "${SecurityGroupCloudFormationName}-DbSg"
Tags:
- Key: service
Value: !Ref "TagService"
- Key: Name
Value: !Sub "peoplesoft-${PillarLowerCase}${EnvironmentLowerCase}-rds"
- Key: environment
Value: !Ref "EnvironmentLowerCase"
- Key: contactnetid
Value: !Ref "TagContactNetid"
- Key: accountnumber
Value: !Ref "TagAccountNumber"
- Key: subaccount
Value: !Ref "TagSubAccount"
- Key: ticketnumber
Value: !Ref "TagTicketNumber"
DeletionPolicy: "Delete"