Restore RDS DB from snapshot#120
Conversation
RaitoBezarius
left a comment
There was a problem hiding this comment.
+1 on handling better errors and a new test, so thank you! Otherwise, it would be awesome to cut this PR into 3 PRs:
(1) Boto3 port.
(2) RDS snapshot feature.
(3) Unrelated minor changes like those on RDS subnets.
Anyway, except those points, LGTM.
| subnet_group: Optional[str] | ||
| vpc_security_groups: Optional[Sequence[str]] = None | ||
| rds_dbinstance_security_groups: Optional[Sequence[str]] = None | ||
| vpc_security_groups: Optional[Sequence[str]] = [] |
There was a problem hiding this comment.
So, is it still relevant to keep Optional ? Same for the line below.
There was a problem hiding this comment.
It is still relevant of course, the 'vpc_security_groups' can be omitted since it's optional but by default it would have the empty array value.
|
|
||
| self.rds_dbinstance_port = int(dbinstance.endpoint[1]) | ||
| self.rds_dbinstance_endpoint = "%s:%d" % dbinstance.endpoint | ||
| self.rds_dbinstance_id = dbinstance["DBInstanceIdentifier"] |
There was a problem hiding this comment.
I'd have abstracted the AWS strings into a String Enum enum.Enum, rather than multiplying hardcoded references to it, that way, it's easy to change them in all the relevant places. But it can be done in a further PR IMHO.
| def __init__(self, name: str, config: nixops.resources.ResourceEval): | ||
| super(RDSDbSubnetGroupDefinition, self).__init__(name, config) | ||
|
|
||
| self.group_name: str = self.config.name |
There was a problem hiding this comment.
I thought it was mostly about RDS snapshot & boto 3 port, is this change really required in this PR?
There was a problem hiding this comment.
This change is to mainly fix the destroy operation bug related to the subnet-group resource but also to streamline the resource definition and follow the standard
| region = nixops.util.attr_property("region", None) | ||
| description = nixops.util.attr_property("description", None) | ||
| subnet_ids = nixops.util.attr_property("subnet_ids", [], "json") | ||
| access_key_id = nixops.util.attr_property("accessKeyId", None) |
There was a problem hiding this comment.
It was moved from line 39 to this place so that in the new line 83, we would access it from the defn directly instead of from the config
tewfik-ghariani
left a comment
There was a problem hiding this comment.
Thanks for the review @RaitoBezarius
Actually I split my commits in a way that each change would be viewed on its own to make the review easier
(1) Boto3 port. fb5ea12
(2) RDS snapshot feature. 576b701
(3) Unrelated minor changes like those on RDS subnets. :
| subnet_group: Optional[str] | ||
| vpc_security_groups: Optional[Sequence[str]] = None | ||
| rds_dbinstance_security_groups: Optional[Sequence[str]] = None | ||
| vpc_security_groups: Optional[Sequence[str]] = [] |
There was a problem hiding this comment.
It is still relevant of course, the 'vpc_security_groups' can be omitted since it's optional but by default it would have the empty array value.
| def __init__(self, name: str, config: nixops.resources.ResourceEval): | ||
| super(RDSDbSubnetGroupDefinition, self).__init__(name, config) | ||
|
|
||
| self.group_name: str = self.config.name |
There was a problem hiding this comment.
This change is to mainly fix the destroy operation bug related to the subnet-group resource but also to streamline the resource definition and follow the standard
| region = nixops.util.attr_property("region", None) | ||
| description = nixops.util.attr_property("description", None) | ||
| subnet_ids = nixops.util.attr_property("subnet_ids", [], "json") | ||
| access_key_id = nixops.util.attr_property("accessKeyId", None) |
There was a problem hiding this comment.
It was moved from line 39 to this place so that in the new line 83, we would access it from the defn directly instead of from the config
This PR introduces the possibility of restoring an RDS DB from snapshot.
Given that the RDS DB instance restored is automatically placed in the default SG, added the support for immediately modifying it to apply the submitted VPC SG
Additionally, the RDS module has been converted to boto3 instead of boto2
Other changes
cc @grahamc, @adisbladis, @RaitoBezarius