Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Storage-type bug fix within VPC
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartornum committed Apr 27, 2015
1 parent 6bfd7a4 commit 090879a
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 39 deletions.
25 changes: 17 additions & 8 deletions bootstrap_cfn/stacks/rds.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,29 @@
"SubnetIds" : [{ "Ref" : "SubnetA" }, { "Ref" : "SubnetB" }, { "Ref" : "SubnetC" }]
}
},
"DBSecurityGroup": {
"Type": "AWS::RDS::DBSecurityGroup",
"DatabaseSG": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "EC2 Access",
"EC2VpcId" : { "Ref" : "VPC" },
"DBSecurityGroupIngress": [
"VpcId" : { "Ref" : "VPC" },
"GroupDescription": "SG for EC2 Access to RDS",
"SecurityGroupIngress": [
{
"CIDRIP": { "Fn::FindInMap" : [ "SubnetConfig", "VPC", "CIDR" ]}
"CidrIp": { "Fn::FindInMap" : [ "SubnetConfig", "VPC", "CIDR" ]},
"IpProtocol": "tcp",
"FromPort": 5432,
"ToPort": 5432
},
{
"CidrIp": { "Fn::FindInMap" : [ "SubnetConfig", "VPC", "CIDR" ]},
"IpProtocol": "tcp",
"FromPort": 3306,
"ToPort": 3306
}
]
}
},
"RDSInstance": {
"DependsOn" : "DBSecurityGroup",
"DependsOn" : "DatabaseSG",
"Type": "AWS::RDS::DBInstance",
"Properties": {
"DBInstanceIdentifier": "",
Expand All @@ -33,7 +42,7 @@
"EngineVersion": "",
"MultiAZ": "",
"DBSubnetGroupName": {"Ref" : "RDSSubnetGroup"},
"DBSecurityGroups": [{"Ref" : "DBSecurityGroup"}],
"VPCSecurityGroups" : [ { "Fn::GetAtt": [ "DatabaseSG", "GroupId" ] } ],
"PubliclyAccessible": false,
"AllowMajorVersionUpgrade": false,
"AutoMinorVersionUpgrade": false
Expand Down
89 changes: 58 additions & 31 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,39 +135,66 @@ def test_custom_s3_policy(self):

def test_rds(self):
known = {
'DBSecurityGroup': {
'DatabaseSG': {
'Type': 'AWS::EC2::SecurityGroup',
'Properties': {
'VpcId': {'Ref': 'VPC'},
'GroupDescription': 'SG for EC2 Access to RDS',
'SecurityGroupIngress': [
{
'CidrIp': {'Fn::FindInMap': ['SubnetConfig', 'VPC', 'CIDR']},
'IpProtocol': 'tcp',
'FromPort': 5432,
'ToPort': 5432
},
{
'CidrIp': {'Fn::FindInMap': ['SubnetConfig', 'VPC', 'CIDR']},
'IpProtocol': 'tcp',
'FromPort': 3306,
'ToPort': 3306
}
]
}
},
'RDSInstance': {
'DependsOn': 'DatabaseSG',
'Type': 'AWS::RDS::DBInstance',
'Properties': {
'DBSecurityGroupIngress': [{'CIDRIP': { 'Fn::FindInMap': ['SubnetConfig', 'VPC', 'CIDR'] }}],
'EC2VpcId': {'Ref': 'VPC'},
'GroupDescription': 'EC2 Access'},
'Type': 'AWS::RDS::DBSecurityGroup'},
'RDSInstance': {
'DependsOn': 'DBSecurityGroup',
'Properties': {
'AllocatedStorage': 5,
'AllowMajorVersionUpgrade': False,
'AutoMinorVersionUpgrade': False,
'BackupRetentionPeriod': 1,
'DBInstanceClass': 'db.t2.micro',
'DBInstanceIdentifier': 'test-dev',
'DBName': 'test',
'DBSecurityGroups': [{'Ref': 'DBSecurityGroup'}],
'DBSubnetGroupName': {'Ref': 'RDSSubnetGroup'},
'Engine': 'postgres',
'EngineVersion': '9.3.5',
'MasterUserPassword': 'testpassword',
'MasterUsername': 'testuser',
'MultiAZ': False,
'PubliclyAccessible': False,
'StorageType': 'gp2'},
'Type': 'AWS::RDS::DBInstance'},
'RDSSubnetGroup': {
'Properties': {
'DBSubnetGroupDescription': 'VPC Subnets',
'SubnetIds': [{'Ref': 'SubnetA'}, {'Ref': 'SubnetB'}, {'Ref': 'SubnetC'}]},
'Type': 'AWS::RDS::DBSubnetGroup'}
'AllocatedStorage': 5,
'AllowMajorVersionUpgrade': False,
'AutoMinorVersionUpgrade': False,
'BackupRetentionPeriod': 1,
'DBInstanceClass': 'db.t2.micro',
'DBInstanceIdentifier': 'test-dev',
'DBName': 'test',
'VPCSecurityGroups': [{'Fn::GetAtt': ['DatabaseSG', 'GroupId']}],
'DBSubnetGroupName': {'Ref': 'RDSSubnetGroup'},
'Engine': 'postgres',
'EngineVersion': '9.3.5',
'MasterUserPassword': 'testpassword',
'MasterUsername': 'testuser',
'MultiAZ': False,
'PubliclyAccessible': False,
'StorageType': 'gp2'
}
},
'RDSSubnetGroup': {
'Properties': {
'DBSubnetGroupDescription': 'VPC Subnets', 'SubnetIds': [
{
'Ref': 'SubnetA'
},
{
'Ref': 'SubnetB'
},
{
'Ref': 'SubnetC'
}
]
},
'Type': 'AWS::RDS::DBSubnetGroup'
}

}

config = ConfigParser(
ProjectConfig(
Expand Down

0 comments on commit 090879a

Please sign in to comment.