diff --git a/tests/test_rds.py b/tests/test_rds.py index 304f725f8..610cfae43 100644 --- a/tests/test_rds.py +++ b/tests/test_rds.py @@ -2,6 +2,8 @@ import troposphere.rds as rds from troposphere import If, Parameter, Ref +AWS_NO_VALUE = "AWS::NoValue" + class TestRDS(unittest.TestCase): @@ -150,9 +152,16 @@ def test_fail_az_and_multiaz(self): MultiAZ=True) with self.assertRaisesRegexp(ValueError, "if MultiAZ is set to "): i.JSONrepr() + i.MultiAZ = "false" + i.JSONrepr() + i.MultiAZ = "true" + with self.assertRaisesRegexp(ValueError, "if MultiAZ is set to "): + i.JSONrepr() + + i.MultiAZ = Ref(AWS_NO_VALUE) + i.JSONrepr() def test_az_and_multiaz_funcs(self): - AWS_NO_VALUE = "AWS::NoValue" db_az = "us-east-1" db_multi_az = Parameter("dbmultiaz", Type="String") i = rds.DBInstance( diff --git a/troposphere/rds.py b/troposphere/rds.py index b6afb627a..0e5342d1c 100644 --- a/troposphere/rds.py +++ b/troposphere/rds.py @@ -199,8 +199,7 @@ def validate(self): multi_az = self.properties.get('MultiAZ', None) if not (isinstance(avail_zone, (AWSHelperFn, nonetype)) and isinstance(multi_az, (AWSHelperFn, nonetype))): - if 'AvailabilityZone' in self.properties and \ - self.properties.get('MultiAZ', None): + if avail_zone and multi_az in [True, 1, '1', 'true', 'True']: raise ValueError("AvailabiltyZone cannot be set on " "DBInstance if MultiAZ is set to true.")