You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR #80 changed the Security Group rules from inline to resource-based.
This is a good move since using inline SG rules is a "bad practice". Inline rules have many issues (one of them is that you can't add new rules to the security group since it's not possible to mix the inline rules and rules as separate resources).
At the same time, this introduced a breaking change: if you want to update the module to the latest version, Terraform will try to add the new resource-based rules to the security group and will fail since the same rules already exist and we can't mix inline rules with resource-based rules.
Note that it's not possible to taint and destroy the security group since it has a dependent object (an Elastic Network Interface), which in turn has its own dependencies.
One possible solution would be to destroy the Aurora RDS cluster completely and recreate it. While possible in some cases (e.g. in dev environments), it could not be feasible in other environments (e.g. a production database has data, and it's not possible to have a long outage).
A better way would be to just destroy the inline security group rules without destroying the security group itself (and any other Aurora resources), and then add the resource-based security group rules.
Here are the steps to do that:
Create a new branch of terraform-aws-rds-cluster module, e.g. strip-inline-sg-rules
In the new branch, comment out all the aws_security_group_rule resources for resource "aws_security_group" "default"
Add empty ingress and egress lists to the security group. NOTE: you can't skip the ingress and egress completely since terraform will not detect any changes to the inline rules (this is a bug/feature of TF):
NOTE: Branch strip-inline-sg-rules has been already created in this repository and steps 1-3 already performed.
The branch strip-inline-sg-rules can be used to perform the next steps.
Update the Aurora cluster project to use the strip-inline-sg-rules branch of the terraform-aws-rds-cluster module
Apply the project. Terraform will just remove the inline rules from the security group without destroying the SG itself and any of the Aurora resources
Update the Aurora cluster project to use the latest release of the terraform-aws-rds-cluster module
osterman
changed the title
How to move from the Security Group inline rules to SG rules as separate resources
How to migrate from the inline Security Group rules to SG rules as separate resources
Sep 24, 2020
This PR #80 changed the Security Group rules from inline to resource-based.
This is a good move since using inline SG rules is a "bad practice". Inline rules have many issues (one of them is that you can't add new rules to the security group since it's not possible to mix the inline rules and rules as separate resources).
At the same time, this introduced a breaking change: if you want to update the module to the latest version, Terraform will try to add the new resource-based rules to the security group and will fail since the same rules already exist and we can't mix inline rules with resource-based rules.
Note that it's not possible to
taint
and destroy the security group since it has a dependent object (an Elastic Network Interface), which in turn has its own dependencies.One possible solution would be to destroy the Aurora RDS cluster completely and recreate it. While possible in some cases (e.g. in
dev
environments), it could not be feasible in other environments (e.g. a production database has data, and it's not possible to have a long outage).A better way would be to just destroy the inline security group rules without destroying the security group itself (and any other Aurora resources), and then add the resource-based security group rules.
Here are the steps to do that:
Create a new branch of
terraform-aws-rds-cluster
module, e.g.strip-inline-sg-rules
In the new branch, comment out all the
aws_security_group_rule
resources forresource "aws_security_group" "default"
Add empty
ingress
andegress
lists to the security group. NOTE: you can't skip theingress
andegress
completely since terraform will not detect any changes to the inline rules (this is a bug/feature of TF):NOTE: Branch
strip-inline-sg-rules
has been already created in this repository and steps 1-3 already performed.The branch
strip-inline-sg-rules
can be used to perform the next steps.strip-inline-sg-rules
branch of theterraform-aws-rds-cluster
moduleApply the project. Terraform will just remove the inline rules from the security group without destroying the SG itself and any of the Aurora resources
Update the Aurora cluster project to use the latest release of the
terraform-aws-rds-cluster
moduleIt takes a few minutes to go through all the steps, so the disruption to the production database will be minimal.
The text was updated successfully, but these errors were encountered: