Add create_before_destroy = true lifecycle rule to default security group
Use name-prefix instead of name for default security group
why
I made upgrade from tag 0.25.0 to 0.37.0. In one of the versions you have changed default description from Managed by Terraform to Security group for Elasticache Redis. This change is forcing replacement as you can see below.
After apply terraform is not able to remove old security group because redis cluster is still using it.
module.redis.aws_security_group.default[0]: Still destroying... [id=WWWWWWWWWW, 50s elapsed]
...
module.redis.aws_security_group.default[0]: Still destroying... [id=WWWWWWWWWW, 10m0s elapsed]
Error: Error deleting security group: DependencyViolation: resource WWWWWWWWWW has a dependent object
status code: 400, request id: 018d6816-daed-425c-a59e-a9d0a5f69f6b
This PR is fixing this issue. create_before_destroy rule will always create new security group before removing old one. With name_prefix we will be sure that new security group will not have duplicated name which could also cause errors.
what
create_before_destroy = true
lifecycle rule to default security groupname-prefix
instead ofname
for default security groupwhy
I made upgrade from tag
0.25.0
to0.37.0
. In one of the versions you have changed default description fromManaged by Terraform
toSecurity group for Elasticache Redis
. This change is forcing replacement as you can see below.After apply terraform is not able to remove old security group because redis cluster is still using it.
This PR is fixing this issue.
create_before_destroy
rule will always create new security group before removing old one. Withname_prefix
we will be sure that new security group will not have duplicated name which could also cause errors.references